koel/resources/assets/js/components/profile-preferences/SpotifyIntegration.spec.ts
2024-10-14 00:37:01 +07:00

23 lines
710 B
TypeScript

import { expect, it } from 'vitest'
import UnitTestCase from '@/__tests__/UnitTestCase'
import { commonStore } from '@/stores'
import SpotifyIntegration from './SpotifyIntegration.vue'
new class extends UnitTestCase {
protected test () {
it.each<[boolean, boolean]>([[false, false], [false, true], [true, false], [true, true]]) (
'renders proper content with Spotify integration status %s, current user admin status %s',
(useSpotify, isAdmin) => {
commonStore.state.uses_spotify = useSpotify
if (isAdmin) {
this.beAdmin()
} else {
this.be()
}
expect(this.render(SpotifyIntegration).html()).toMatchSnapshot()
},
)
}
}