koel/resources/assets/js/components/screens/search/SearchExcerptsScreen.spec.ts

19 lines
606 B
TypeScript
Raw Normal View History

import { expect, it } from 'vitest'
2022-05-13 17:58:38 +00:00
import UnitTestCase from '@/__tests__/UnitTestCase'
import { searchStore } from '@/stores'
import { eventBus } from '@/utils'
import SearchExceptsScreen from './SearchExcerptsScreen.vue'
2022-05-13 17:58:38 +00:00
new class extends UnitTestCase {
protected test () {
it('executes searching when the search keyword is changed', async () => {
const mock = this.mock(searchStore, 'excerptSearch')
this.render(SearchExceptsScreen)
eventBus.emit('SEARCH_KEYWORDS_CHANGED', 'search me')
await this.tick()
expect(mock).toHaveBeenCalledWith('search me')
})
}
}