mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
feat(test): add RepeatModeSwitch component tests
This commit is contained in:
parent
3a4eda4ab8
commit
45669aa9de
1 changed files with 20 additions and 0 deletions
20
resources/assets/js/components/ui/RepeatModeSwitch.spec.ts
Normal file
20
resources/assets/js/components/ui/RepeatModeSwitch.spec.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { expect, it } from 'vitest'
|
||||
import { preferenceStore } from '@/stores'
|
||||
import ComponentTestCase from '@/__tests__/ComponentTestCase'
|
||||
import RepeatModeSwitch from './RepeatModeSwitch.vue'
|
||||
import { fireEvent } from '@testing-library/vue'
|
||||
import { playbackService } from '@/services'
|
||||
|
||||
new class extends ComponentTestCase {
|
||||
protected test () {
|
||||
it('changes mode', async () => {
|
||||
const mock = this.mock(playbackService, 'changeRepeatMode')
|
||||
preferenceStore.state.repeatMode = 'NO_REPEAT'
|
||||
const { getByRole } = this.render(RepeatModeSwitch)
|
||||
|
||||
await fireEvent.click(getByRole('button'))
|
||||
|
||||
expect(mock).toHaveBeenCalledOnce()
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue