mirror of
https://github.com/koel/koel
synced 2024-12-24 19:43:06 +00:00
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { expect, it } from 'vitest'
|
|
import { commonStore } from '@/stores'
|
|
import UnitTestCase from '@/__tests__/UnitTestCase'
|
|
import { http } from '@/services'
|
|
import { screen, waitFor } from '@testing-library/vue'
|
|
import AboutKoelModel from './AboutKoelModal.vue'
|
|
|
|
new class extends UnitTestCase {
|
|
private renderComponent () {
|
|
return this.render(AboutKoelModel, {
|
|
global: {
|
|
stubs: {
|
|
SponsorList: this.stub('sponsor-list')
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
protected test () {
|
|
it('renders', async () => {
|
|
commonStore.state.current_version = 'v0.0.0'
|
|
commonStore.state.latest_version = 'v0.0.0'
|
|
|
|
expect(this.renderComponent().html()).toMatchSnapshot()
|
|
})
|
|
|
|
it('shows new version', () => {
|
|
commonStore.state.current_version = 'v1.0.0'
|
|
commonStore.state.latest_version = 'v1.0.1'
|
|
this.actingAsAdmin().renderComponent().getByTestId('new-version-about')
|
|
})
|
|
|
|
it('shows demo notation', async () => {
|
|
const getMock = this.mock(http, 'get').mockResolvedValue([])
|
|
// @ts-ignore
|
|
import.meta.env.VITE_KOEL_ENV = 'demo'
|
|
|
|
this.renderComponent()
|
|
|
|
await waitFor(() => {
|
|
screen.getByTestId('demo-credits')
|
|
expect(getMock).toHaveBeenCalledWith('demo/credits')
|
|
})
|
|
})
|
|
}
|
|
}
|