mirror of
https://github.com/koel/koel
synced 2024-12-22 18:43:21 +00:00
30 lines
853 B
TypeScript
30 lines
853 B
TypeScript
import { screen } from '@testing-library/vue'
|
|
import { expect, it } from 'vitest'
|
|
import UnitTestCase from '@/__tests__/UnitTestCase'
|
|
import Router from '@/router'
|
|
import Component from './FooterQueueButton.vue'
|
|
|
|
new class extends UnitTestCase {
|
|
protected test () {
|
|
it('goes to queue screen', async () => {
|
|
const goMock = this.mock(Router, 'go')
|
|
this.render(Component)
|
|
|
|
await this.user.click(screen.getByRole('button'))
|
|
expect(goMock).toHaveBeenCalledWith('queue')
|
|
})
|
|
|
|
it('goes back if current screen is Queue', async () => {
|
|
this.router.$currentRoute.value = {
|
|
screen: 'Queue',
|
|
path: '/queue'
|
|
}
|
|
|
|
const goMock = this.mock(Router, 'go')
|
|
this.render(Component)
|
|
|
|
await this.user.click(screen.getByRole('button'))
|
|
expect(goMock).toHaveBeenCalledWith(-1)
|
|
})
|
|
}
|
|
}
|