2022-05-09 09:59:31 +00:00
|
|
|
import { it } from 'vitest'
|
2022-05-09 08:14:56 +00:00
|
|
|
import { playlistStore } from '@/stores'
|
|
|
|
import factory from '@/__tests__/factory'
|
|
|
|
import PlaylistSidebarList from './PlaylistSidebarList.vue'
|
|
|
|
import PlaylistSidebarItem from './PlaylistSidebarItem.vue'
|
2022-05-13 17:58:38 +00:00
|
|
|
import UnitTestCase from '@/__tests__/UnitTestCase'
|
2022-05-09 08:14:56 +00:00
|
|
|
|
2022-05-13 17:58:38 +00:00
|
|
|
new class extends UnitTestCase {
|
2022-05-09 09:59:31 +00:00
|
|
|
protected test () {
|
|
|
|
it('renders all playlists', () => {
|
|
|
|
playlistStore.state.playlists = [
|
|
|
|
factory<Playlist>('playlist', { name: 'Foo Playlist' }),
|
|
|
|
factory<Playlist>('playlist', { name: 'Bar Playlist' }),
|
|
|
|
factory<Playlist>('playlist', { name: 'Smart Playlist', is_smart: true })
|
|
|
|
]
|
2022-05-09 08:14:56 +00:00
|
|
|
|
2022-05-09 09:59:31 +00:00
|
|
|
const { getByText } = this.render(PlaylistSidebarList, {
|
|
|
|
global: {
|
|
|
|
stubs: {
|
|
|
|
PlaylistSidebarItem
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2022-05-09 08:14:56 +00:00
|
|
|
|
2022-05-09 09:59:31 +00:00
|
|
|
;['Favorites', 'Recently Played', 'Foo Playlist', 'Bar Playlist', 'Smart Playlist'].forEach(t => getByText(t))
|
2022-05-09 08:14:56 +00:00
|
|
|
})
|
|
|
|
|
2022-05-09 09:59:31 +00:00
|
|
|
// other functionalities are handled by E2E
|
|
|
|
}
|
|
|
|
}
|