2022-05-09 11:21:02 +00:00
|
|
|
import { expect, it } from 'vitest'
|
|
|
|
import { searchStore } from '@/stores'
|
2022-05-13 17:58:38 +00:00
|
|
|
import UnitTestCase from '@/__tests__/UnitTestCase'
|
2022-05-09 11:21:02 +00:00
|
|
|
import SearchSongResultsScreen from './SearchSongResultsScreen.vue'
|
|
|
|
|
2022-05-13 17:58:38 +00:00
|
|
|
new class extends UnitTestCase {
|
2022-05-09 11:21:02 +00:00
|
|
|
protected test () {
|
|
|
|
it('searches for prop query on created', () => {
|
|
|
|
const resetResultMock = this.mock(searchStore, 'resetSongResultState')
|
|
|
|
const searchMock = this.mock(searchStore, 'songSearch')
|
2022-10-08 10:54:25 +00:00
|
|
|
|
|
|
|
this.router.activateRoute({ path: 'search-songs', screen: 'Search.Songs' }, { q: 'search me' })
|
|
|
|
this.render(SearchSongResultsScreen)
|
2022-05-09 11:21:02 +00:00
|
|
|
|
|
|
|
expect(resetResultMock).toHaveBeenCalled()
|
|
|
|
expect(searchMock).toHaveBeenCalledWith('search me')
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|