mirror of
https://github.com/koel/koel
synced 2025-02-17 13:58:28 +00:00
fix(test): AboutKoelModal tests
This commit is contained in:
parent
31094fe283
commit
c820779685
3 changed files with 6 additions and 23 deletions
|
@ -2,42 +2,25 @@ import { expect, it } from 'vitest'
|
|||
import { commonStore } from '@/stores'
|
||||
import UnitTestCase from '@/__tests__/UnitTestCase'
|
||||
import AboutKoelModel from './AboutKoelModal.vue'
|
||||
import Btn from '@/components/ui/Btn.vue'
|
||||
|
||||
new class extends UnitTestCase {
|
||||
protected beforeEach () {
|
||||
super.beforeEach(() => (VITE_KOEL_ENV = ''))
|
||||
}
|
||||
|
||||
protected test () {
|
||||
it('renders', async () => {
|
||||
commonStore.state.current_version = 'v0.0.0'
|
||||
commonStore.state.latest_version = 'v0.0.0'
|
||||
|
||||
const { html } = this.render(AboutKoelModel, {
|
||||
global: {
|
||||
stubs: {
|
||||
Btn
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
expect(html()).toMatchSnapshot()
|
||||
expect(this.render(AboutKoelModel).html()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('shows new version', () => {
|
||||
commonStore.state.current_version = 'v1.0.0'
|
||||
commonStore.state.latest_version = 'v1.0.1'
|
||||
const { findByTestId } = this.actingAsAdmin().render(AboutKoelModel)
|
||||
|
||||
findByTestId('new-version-about')
|
||||
this.actingAsAdmin().render(AboutKoelModel).findByTestId('new-version-about')
|
||||
})
|
||||
|
||||
it('shows demo notation', () => {
|
||||
VITE_KOEL_ENV = 'demo'
|
||||
const { findByTestId } = this.render(AboutKoelModel)
|
||||
|
||||
findByTestId('demo-credits')
|
||||
import.meta.env.VITE_KOEL_ENV = 'demo'
|
||||
this.render(AboutKoelModel).findByTestId('demo-credits')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ exports[`renders 1`] = `
|
|||
<h1 class="text-white" data-v-0ef2b3f8="">About Koel</h1>
|
||||
</header>
|
||||
<main data-v-0ef2b3f8="">
|
||||
<div class="logo" data-v-0ef2b3f8=""><img alt="Koel's logo" src="/resources/assets/img/logo.svg" width="128" data-v-0ef2b3f8=""></div>
|
||||
<div class="logo" data-v-0ef2b3f8=""><img alt="Koel's logo" src="undefined/resources/assets/img/logo.svg" width="128" data-v-0ef2b3f8=""></div>
|
||||
<p class="current-version" data-v-0ef2b3f8="">v0.0.0</p>
|
||||
<!--v-if-->
|
||||
<p class="author" data-v-0ef2b3f8=""> Made with ❤️ by <a href="https://github.com/phanan" rel="noopener" target="_blank" data-v-0ef2b3f8="">Phan An</a> and quite a few <a href="https://github.com/koel/core/graphs/contributors" rel="noopener" target="_blank" data-v-0ef2b3f8="">awesome</a> <a href="https://github.com/koel/koel/graphs/contributors" rel="noopener" target="_blank" data-v-0ef2b3f8="">contributors</a>. </p>
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
exports[`shows after a delay 1`] = `
|
||||
<div class="support-bar" data-testid="support-bar" data-v-0db4e332="">
|
||||
<p data-v-0db4e332=""> Loving Koel? Please consider supporting its development via <a href="https://github.com/users/phanan/sponsorship" rel="noopener" target="_blank" data-v-0db4e332="">GitHub Sponsors</a> and/or <a href="https://opencollective.com/koel" rel="noopener" target="_blank" data-v-0db4e332="">OpenCollective</a>. </p><button data-testid="hide-support-koel" data-v-0db4e332="">Hide</button><span class="sep" data-v-0db4e332=""></span><button data-testid="stop-support-koel-bugging" data-v-0db4e332="">Don't bug me again</button>
|
||||
<p data-v-0db4e332=""> Loving Koel? Please consider supporting its development via <a href="https://github.com/users/phanan/sponsorship" rel="noopener" target="_blank" data-v-0db4e332="">GitHub Sponsors</a> and/or <a href="https://opencollective.com/koel" rel="noopener" target="_blank" data-v-0db4e332="">OpenCollective</a>. </p><button data-testid="hide-support-koel" type="button" data-v-0db4e332="">Hide</button><span class="sep" data-v-0db4e332=""></span><button data-testid="stop-support-koel-bugging" type="button" data-v-0db4e332=""> Don't bug me again </button>
|
||||
</div>
|
||||
`;
|
||||
|
|
Loading…
Add table
Reference in a new issue