2022-05-11 17:10:18 +00:00
|
|
|
import { expect, it } from 'vitest'
|
|
|
|
import { preferenceStore } from '@/stores'
|
2022-05-13 17:58:38 +00:00
|
|
|
import UnitTestCase from '@/__tests__/UnitTestCase'
|
2022-11-29 10:18:58 +00:00
|
|
|
import { screen } from '@testing-library/vue'
|
2022-05-11 17:10:18 +00:00
|
|
|
import { playbackService } from '@/services'
|
2022-07-21 09:54:38 +00:00
|
|
|
import RepeatModeSwitch from './RepeatModeSwitch.vue'
|
2022-05-11 17:10:18 +00:00
|
|
|
|
2022-05-13 17:58:38 +00:00
|
|
|
new class extends UnitTestCase {
|
2022-05-11 17:10:18 +00:00
|
|
|
protected test () {
|
|
|
|
it('changes mode', async () => {
|
|
|
|
const mock = this.mock(playbackService, 'changeRepeatMode')
|
|
|
|
preferenceStore.state.repeatMode = 'NO_REPEAT'
|
2022-11-29 10:18:58 +00:00
|
|
|
this.render(RepeatModeSwitch)
|
2022-05-11 17:10:18 +00:00
|
|
|
|
2022-11-29 10:18:58 +00:00
|
|
|
await this.user.click(screen.getByRole('button'))
|
2022-05-11 17:10:18 +00:00
|
|
|
|
|
|
|
expect(mock).toHaveBeenCalledOnce()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|