2022-05-09 09:59:31 +00:00
|
|
|
import { expect, it } from 'vitest'
|
2022-05-11 09:12:26 +00:00
|
|
|
import { commonStore } from '@/stores'
|
2022-05-09 09:59:31 +00:00
|
|
|
import ComponentTestCase from '@/__tests__/ComponentTestCase'
|
2022-05-07 09:26:32 +00:00
|
|
|
import AboutKoelModel from './AboutKoelModal.vue'
|
|
|
|
import Btn from '@/components/ui/Btn.vue'
|
|
|
|
|
2022-05-09 09:59:31 +00:00
|
|
|
new class extends ComponentTestCase {
|
|
|
|
protected beforeEach () {
|
|
|
|
super.beforeEach(() => (KOEL_ENV = ''));
|
|
|
|
}
|
|
|
|
|
|
|
|
protected test () {
|
|
|
|
it('renders', async () => {
|
|
|
|
commonStore.state.currentVersion = 'v0.0.0'
|
|
|
|
commonStore.state.latestVersion = 'v0.0.0'
|
|
|
|
|
|
|
|
const { html } = this.render(AboutKoelModel, {
|
|
|
|
global: {
|
|
|
|
stubs: {
|
|
|
|
Btn
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
expect(html()).toMatchSnapshot()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('shows new version', () => {
|
|
|
|
commonStore.state.currentVersion = 'v1.0.0'
|
|
|
|
commonStore.state.latestVersion = 'v1.0.1'
|
2022-05-11 09:12:26 +00:00
|
|
|
const { findByTestId } = this.actingAsAdmin().render(AboutKoelModel)
|
2022-05-09 09:59:31 +00:00
|
|
|
|
|
|
|
findByTestId('new-version-about')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('shows demo notation', () => {
|
|
|
|
KOEL_ENV = 'demo'
|
|
|
|
const { findByTestId } = this.render(AboutKoelModel)
|
|
|
|
|
|
|
|
findByTestId('demo-credits')
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|