2023-01-03 13:17:22 +00:00
|
|
|
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
|
|
|
import { createWrapper, axios } from 'app/test/vitest/helper';
|
|
|
|
import TicketBoxing from 'pages/Ticket/Card/TicketBoxing.vue';
|
2022-12-20 11:30:25 +00:00
|
|
|
|
|
|
|
// #4836 - Investigate how to test q-drawer outside
|
|
|
|
// q-layout or how to teleport q-drawer inside
|
2023-01-03 13:17:22 +00:00
|
|
|
describe.skip('TicketBoxing', () => {
|
2022-12-20 11:30:25 +00:00
|
|
|
let vm;
|
|
|
|
beforeAll(() => {
|
|
|
|
vm = createWrapper(TicketBoxing).vm;
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
2023-01-03 13:17:22 +00:00
|
|
|
vi.clearAllMocks();
|
2022-12-20 11:30:25 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('getVideoList()', () => {
|
|
|
|
it('should when response videoList use to list', async () => {
|
|
|
|
const expeditionId = 1;
|
|
|
|
const timed = {
|
|
|
|
min: 1,
|
2022-12-22 12:46:43 +00:00
|
|
|
max: 2,
|
|
|
|
};
|
|
|
|
const videoList = ['2022-01-01T01-01-00.mp4', '2022-02-02T02-02-00.mp4', '2022-03-03T03-03-00.mp4'];
|
2022-12-20 11:30:25 +00:00
|
|
|
|
2023-01-03 13:17:22 +00:00
|
|
|
vi.spyOn(axios, 'get').mockResolvedValue({ data: videoList });
|
|
|
|
vi.spyOn(vm.quasar, 'notify');
|
2022-12-20 11:30:25 +00:00
|
|
|
|
|
|
|
await vm.getVideoList(expeditionId, timed);
|
|
|
|
|
|
|
|
expect(vm.videoList.length).toEqual(videoList.length);
|
|
|
|
expect(vm.slide).toEqual(videoList.reverse()[0]);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should if not have video show notify', async () => {
|
|
|
|
const expeditionId = 1;
|
|
|
|
const timed = {
|
|
|
|
min: 1,
|
2022-12-22 12:46:43 +00:00
|
|
|
max: 2,
|
|
|
|
};
|
2022-12-20 11:30:25 +00:00
|
|
|
|
2023-01-03 13:17:22 +00:00
|
|
|
vi.spyOn(axios, 'get').mockResolvedValue({ data: [] });
|
|
|
|
vi.spyOn(vm.quasar, 'notify');
|
2022-12-20 11:30:25 +00:00
|
|
|
|
|
|
|
await vm.getVideoList(expeditionId, timed);
|
|
|
|
|
2022-12-22 12:46:43 +00:00
|
|
|
expect(vm.quasar.notify).toHaveBeenCalledWith(expect.objectContaining({ type: 'negative' }));
|
2022-12-20 11:30:25 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|