2024-04-23 15:20:40 +00:00
|
|
|
import { screen } from '@testing-library/vue'
|
|
|
|
import { expect, it } from 'vitest'
|
|
|
|
import UnitTestCase from '@/__tests__/UnitTestCase'
|
|
|
|
import { eventBus } from '@/utils'
|
2024-05-19 05:49:42 +00:00
|
|
|
import SidebarYourLibrarySection from './SidebarYourLibrarySection.vue'
|
2024-04-23 15:20:40 +00:00
|
|
|
|
|
|
|
new class extends UnitTestCase {
|
|
|
|
protected test () {
|
|
|
|
it('shows YouTube item if a video is played', async () => {
|
2024-05-19 05:49:42 +00:00
|
|
|
this.render(SidebarYourLibrarySection)
|
2024-04-23 15:20:40 +00:00
|
|
|
expect(screen.queryByTestId('youtube')).toBeNull()
|
|
|
|
|
|
|
|
eventBus.emit('PLAY_YOUTUBE_VIDEO', {
|
|
|
|
id: 'video-id',
|
|
|
|
title: 'Another One Bites the Dust',
|
|
|
|
})
|
|
|
|
|
|
|
|
await this.tick()
|
|
|
|
screen.getByTestId('youtube')
|
|
|
|
screen.getByText('Another One Bites the Dust')
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|