feat(test): add SearchSongResultsScreen component tests

This commit is contained in:
Phan An 2022-05-09 13:21:02 +02:00
parent 719b3e7f18
commit 7c70d4bbdc
No known key found for this signature in database
GPG key ID: A81E4477F0BB6FDC

View file

@ -0,0 +1,21 @@
import { expect, it } from 'vitest'
import { searchStore } from '@/stores'
import ComponentTestCase from '@/__tests__/ComponentTestCase'
import SearchSongResultsScreen from './SearchSongResultsScreen.vue'
new class extends ComponentTestCase {
protected test () {
it('searches for prop query on created', () => {
const resetResultMock = this.mock(searchStore, 'resetSongResultState')
const searchMock = this.mock(searchStore, 'songSearch')
this.render(SearchSongResultsScreen, {
props: {
q: 'search me'
}
})
expect(resetResultMock).toHaveBeenCalled()
expect(searchMock).toHaveBeenCalledWith('search me')
})
}
}