0
0
Fork 0

Updated unit tests

This commit is contained in:
Joan Sanchez 2022-11-18 14:12:08 +01:00
parent 25443b2c50
commit d33da3cf3c
4 changed files with 25 additions and 36 deletions

View File

@ -38,6 +38,8 @@ module.exports = {
'^src/(.*)$': '<rootDir>/src/$1', '^src/(.*)$': '<rootDir>/src/$1',
'^app/(.*)$': '<rootDir>/$1', '^app/(.*)$': '<rootDir>/$1',
'^components/(.*)$': '<rootDir>/src/components/$1', '^components/(.*)$': '<rootDir>/src/components/$1',
'^composables/(.*)$': '<rootDir>/src/composables/$1',
'^filters/(.*)$': '<rootDir>/src/filters/$1',
'^layouts/(.*)$': '<rootDir>/src/layouts/$1', '^layouts/(.*)$': '<rootDir>/src/layouts/$1',
'^pages/(.*)$': '<rootDir>/src/pages/$1', '^pages/(.*)$': '<rootDir>/src/pages/$1',
'^assets/(.*)$': '<rootDir>/src/assets/$1', '^assets/(.*)$': '<rootDir>/src/assets/$1',

12
package-lock.json generated
View File

@ -5754,9 +5754,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001344", "version": "1.0.30001431",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001344.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001431.tgz",
"integrity": "sha512-0ZFjnlCaXNOAYcV7i+TtdKBp0L/3XEU2MF/x6Du1lrh+SRX4IfzIVL4HNJg5pB2PmFb8rszIGyOvsZnqqRoc2g==", "integrity": "sha512-zBUoFU0ZcxpvSt9IU66dXVT/3ctO1cy4y9cscs1szkPlcWb6pasYM144GqrUygUbT+k7cmUCW61cvskjcv0enQ==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@ -25351,9 +25351,9 @@
} }
}, },
"caniuse-lite": { "caniuse-lite": {
"version": "1.0.30001344", "version": "1.0.30001431",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001344.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001431.tgz",
"integrity": "sha512-0ZFjnlCaXNOAYcV7i+TtdKBp0L/3XEU2MF/x6Du1lrh+SRX4IfzIVL4HNJg5pB2PmFb8rszIGyOvsZnqqRoc2g==", "integrity": "sha512-zBUoFU0ZcxpvSt9IU66dXVT/3ctO1cy4y9cscs1szkPlcWb6pasYM144GqrUygUbT+k7cmUCW61cvskjcv0enQ==",
"dev": true "dev": true
}, },
"capture-exit": { "capture-exit": {

View File

@ -20,44 +20,29 @@ jest.mock('vue-router', () => ({
describe('ClaimDescriptorMenu', () => { describe('ClaimDescriptorMenu', () => {
let vm; let vm;
beforeAll(() => { beforeAll(() => {
vm = createWrapper(ClaimDescriptorMenu).vm; vm = createWrapper(ClaimDescriptorMenu, {
propsData: {
claim: {
id: 1
}
}
}).vm;
}); });
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
}); });
describe('getVideoList()', () => { describe('deleteClaim()', () => {
it('should when response videoList use to list', async () => { it('should delete the claim', async () => {
const expeditionId = 1; jest.spyOn(axios, 'delete').mockResolvedValue({ data: true });
const timed = {
min: 1,
max: 2,
};
const videoList = ['2022-01-01T01-01-00.mp4', '2022-02-02T02-02-00.mp4', '2022-03-03T03-03-00.mp4'];
jest.spyOn(axios, 'get').mockResolvedValue({ data: videoList });
jest.spyOn(vm.quasar, 'notify'); jest.spyOn(vm.quasar, 'notify');
await vm.getVideoList(expeditionId, timed); await vm.deleteClaim();
expect(vm.videoList.length).toEqual(videoList.length); expect(vm.quasar.notify).toHaveBeenCalledWith(expect.objectContaining(
expect(vm.slide).toEqual(videoList.reverse()[0]); { 'type': 'positive' }
}); ));
it('should if not have video show notify', async () => {
const expeditionId = 1;
const timed = {
min: 1,
max: 2,
};
jest.spyOn(axios, 'get').mockResolvedValue({ data: [] });
jest.spyOn(vm.quasar, 'notify');
await vm.getVideoList(expeditionId, timed);
expect(vm.quasar.notify).toHaveBeenCalledWith(expect.objectContaining({ type: 'negative' }));
}); });
}); });
}); });

View File

@ -17,7 +17,9 @@ jest.mock('vue-router', () => ({
}), }),
})); }));
describe('TicketBoxing', () => { // #4836 - Investigate how to test q-drawer outside
// q-layout or how to teleport q-drawer inside
xdescribe('TicketBoxing', () => {
let vm; let vm;
beforeAll(() => { beforeAll(() => {
vm = createWrapper(TicketBoxing).vm; vm = createWrapper(TicketBoxing).vm;