2022-12-20 11:30:25 +00:00
|
|
|
import { jest, describe, expect, it, beforeAll } from '@jest/globals';
|
2022-12-22 12:46:43 +00:00
|
|
|
import { createWrapper, axios } from 'app/test/jest/jestHelpers';
|
2022-12-20 11:30:25 +00:00
|
|
|
import TicketBoxing from '../TicketBoxing.vue';
|
|
|
|
|
|
|
|
const mockPush = jest.fn();
|
|
|
|
|
|
|
|
jest.mock('vue-router', () => ({
|
|
|
|
useRouter: () => ({
|
|
|
|
push: mockPush,
|
|
|
|
currentRoute: {
|
|
|
|
value: {
|
|
|
|
params: {
|
2022-12-22 12:46:43 +00:00
|
|
|
id: 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
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
|
|
|
|
xdescribe('TicketBoxing', () => {
|
|
|
|
let vm;
|
|
|
|
beforeAll(() => {
|
|
|
|
vm = createWrapper(TicketBoxing).vm;
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
jest.clearAllMocks();
|
|
|
|
});
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
jest.spyOn(axios, 'get').mockResolvedValue({ data: videoList });
|
|
|
|
jest.spyOn(vm.quasar, 'notify');
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
jest.spyOn(axios, 'get').mockResolvedValue({ data: [] });
|
2022-12-22 12:46:43 +00:00
|
|
|
jest.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
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|