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

31 lines
899 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'
2024-05-19 05:49:42 +00:00
import { CurrentPlayableKey } 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', {
2022-10-13 15:18:47 +00:00
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: {
2024-05-19 05:49:42 +00:00
[<symbol>CurrentPlayableKey]: ref(song)
2022-10-13 15:18:47 +00:00
}
}
}).html()).toMatchSnapshot()
})
}
}