2022-05-13 17:58:38 +00:00
|
|
|
import { eventBus } from '@/utils'
|
|
|
|
import factory from '@/__tests__/factory'
|
|
|
|
import { expect, it } from 'vitest'
|
|
|
|
import UnitTestCase from '@/__tests__/UnitTestCase'
|
|
|
|
import { youTubeService } from './youTubeService'
|
|
|
|
|
|
|
|
new class extends UnitTestCase {
|
|
|
|
protected test () {
|
|
|
|
it('plays a video', () => {
|
2024-06-01 18:02:27 +00:00
|
|
|
const video = factory('video', {
|
2022-05-13 17:58:38 +00:00
|
|
|
id: {
|
2024-10-13 17:37:01 +00:00
|
|
|
videoId: 'foo',
|
2022-05-13 17:58:38 +00:00
|
|
|
},
|
|
|
|
snippet: {
|
2024-10-13 17:37:01 +00:00
|
|
|
title: 'Bar',
|
|
|
|
},
|
2022-05-13 17:58:38 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
const emitMock = this.mock(eventBus, 'emit')
|
|
|
|
|
|
|
|
youTubeService.play(video)
|
|
|
|
|
|
|
|
expect(emitMock).toHaveBeenCalledWith('PLAY_YOUTUBE_VIDEO', { id: 'foo', title: 'Bar' })
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|