koel/resources/assets/js/components/layout/app-footer/FooterSongInfo.spec.ts

31 lines
897 B
TypeScript
Raw Normal View History

2022-10-13 15:18:47 +00:00
import { expect, it } from 'vitest'
2022-12-02 16:17:37 +00:00
import { ref } from 'vue'
2022-10-13 15:18:47 +00:00
import factory from '@/__tests__/factory'
import UnitTestCase from '@/__tests__/UnitTestCase'
import { CurrentSongKey } from '@/symbols'
2022-12-02 16:17:37 +00:00
import FooterSongInfo from './FooterSongInfo.vue'
2022-10-13 15:18:47 +00:00
new class extends UnitTestCase {
protected test () {
it('renders with no current song', () => expect(this.render(FooterSongInfo).html()).toMatchSnapshot())
it('renders with current song', () => {
const song = factory<Song>('song', {
title: 'Fahrstuhl zum Mond',
album_cover: 'https://via.placeholder.com/150',
playback_state: 'Playing',
artist_id: 10,
artist_name: 'Led Zeppelin'
})
expect(this.render(FooterSongInfo, {
global: {
provide: {
2022-12-02 16:17:37 +00:00
[<symbol>CurrentSongKey]: ref(song)
2022-10-13 15:18:47 +00:00
}
}
}).html()).toMatchSnapshot()
})
}
}