feat: updates
This commit is contained in:
parent
ff63a8fd11
commit
5f2b71dc70
|
@ -54,12 +54,17 @@
|
||||||
"postcss": "^8.4.23",
|
"postcss": "^8.4.23",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"sass": "^1.83.4",
|
"sass": "^1.83.4",
|
||||||
"vitest": "^2.0.0"
|
"vitest": "^3.0.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^20 || ^18 || ^16",
|
"node": "^20 || ^18 || ^16",
|
||||||
"npm": ">= 8.1.2",
|
"npm": ">= 8.1.2",
|
||||||
"yarn": ">= 1.21.1",
|
"yarn": ">= 1.21.1",
|
||||||
"bun": ">= 1.0.25"
|
"bun": ">= 1.0.25"
|
||||||
|
},
|
||||||
|
"overrides": {
|
||||||
|
"@vitejs/plugin-vue": "^5.2.1",
|
||||||
|
"vite": "^6.0.11",
|
||||||
|
"vitest": "^0.31.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
582
pnpm-lock.yaml
582
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,7 @@
|
||||||
import { describe, expect, it, beforeEach, afterEach, vi } from 'vitest';
|
import { describe, expect, it, beforeEach, afterEach, vi } from 'vitest';
|
||||||
import { createWrapper } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
import VnVisibleColumn from '../VnVisibleColumn.vue';
|
import VnVisibleColumn from '../VnVisibleColumn.vue';
|
||||||
import { axios } from 'app/test/vitest/helper';
|
import { default as axios } from 'axios';
|
||||||
|
|
||||||
describe('VnVisibleColumns', () => {
|
describe('VnVisibleColumns', () => {
|
||||||
let wrapper;
|
let wrapper;
|
||||||
let vm;
|
let vm;
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import { default as axios } from 'axios';
|
||||||
|
|
||||||
import CrudModel from 'components/CrudModel.vue';
|
import CrudModel from 'components/CrudModel.vue';
|
||||||
import { vi, afterEach, beforeEach, beforeAll, describe, expect, it } from 'vitest';
|
import { vi, afterEach, beforeEach, beforeAll, describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
|
@ -30,8 +32,8 @@ describe('CrudModel', () => {
|
||||||
saveFn: '',
|
saveFn: '',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
wrapper=wrapper.wrapper;
|
wrapper = wrapper.wrapper;
|
||||||
vm=wrapper.vm;
|
vm = wrapper.vm;
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@ -143,14 +145,14 @@ describe('CrudModel', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return true if object is empty', async () => {
|
it('should return true if object is empty', async () => {
|
||||||
dummyObj ={};
|
dummyObj = {};
|
||||||
result = vm.isEmpty(dummyObj);
|
result = vm.isEmpty(dummyObj);
|
||||||
|
|
||||||
expect(result).toBe(true);
|
expect(result).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return false if object is not empty', async () => {
|
it('should return false if object is not empty', async () => {
|
||||||
dummyObj = {a:1, b:2, c:3};
|
dummyObj = { a: 1, b: 2, c: 3 };
|
||||||
result = vm.isEmpty(dummyObj);
|
result = vm.isEmpty(dummyObj);
|
||||||
|
|
||||||
expect(result).toBe(false);
|
expect(result).toBe(false);
|
||||||
|
@ -158,29 +160,31 @@ describe('CrudModel', () => {
|
||||||
|
|
||||||
it('should return true if array is empty', async () => {
|
it('should return true if array is empty', async () => {
|
||||||
dummyArray = [];
|
dummyArray = [];
|
||||||
result = vm.isEmpty(dummyArray);
|
result = vm.isEmpty(dummyArray);
|
||||||
|
|
||||||
expect(result).toBe(true);
|
expect(result).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return false if array is not empty', async () => {
|
it('should return false if array is not empty', async () => {
|
||||||
dummyArray = [1,2,3];
|
dummyArray = [1, 2, 3];
|
||||||
result = vm.isEmpty(dummyArray);
|
result = vm.isEmpty(dummyArray);
|
||||||
|
|
||||||
expect(result).toBe(false);
|
expect(result).toBe(false);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('resetData()', () => {
|
describe('resetData()', () => {
|
||||||
it('should add $index to elements in data[] and sets originalData and formData with data', async () => {
|
it('should add $index to elements in data[] and sets originalData and formData with data', async () => {
|
||||||
data = [{
|
data = [
|
||||||
name: 'Tony',
|
{
|
||||||
lastName: 'Stark',
|
name: 'Tony',
|
||||||
age: 42,
|
lastName: 'Stark',
|
||||||
}];
|
age: 42,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
vm.resetData(data);
|
vm.resetData(data);
|
||||||
|
|
||||||
expect(vm.originalData).toEqual(data);
|
expect(vm.originalData).toEqual(data);
|
||||||
expect(vm.originalData[0].$index).toEqual(0);
|
expect(vm.originalData[0].$index).toEqual(0);
|
||||||
expect(vm.formData).toEqual(data);
|
expect(vm.formData).toEqual(data);
|
||||||
|
@ -200,7 +204,7 @@ describe('CrudModel', () => {
|
||||||
lastName: 'Stark',
|
lastName: 'Stark',
|
||||||
age: 42,
|
age: 42,
|
||||||
};
|
};
|
||||||
|
|
||||||
vm.resetData(data);
|
vm.resetData(data);
|
||||||
|
|
||||||
expect(vm.originalData).toEqual(data);
|
expect(vm.originalData).toEqual(data);
|
||||||
|
@ -210,17 +214,19 @@ describe('CrudModel', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('saveChanges()', () => {
|
describe('saveChanges()', () => {
|
||||||
data = [{
|
data = [
|
||||||
name: 'Tony',
|
{
|
||||||
lastName: 'Stark',
|
name: 'Tony',
|
||||||
age: 42,
|
lastName: 'Stark',
|
||||||
}];
|
age: 42,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
it('should call saveFn if exists', async () => {
|
it('should call saveFn if exists', async () => {
|
||||||
await wrapper.setProps({ saveFn: vi.fn() });
|
await wrapper.setProps({ saveFn: vi.fn() });
|
||||||
|
|
||||||
vm.saveChanges(data);
|
vm.saveChanges(data);
|
||||||
|
|
||||||
expect(vm.saveFn).toHaveBeenCalledOnce();
|
expect(vm.saveFn).toHaveBeenCalledOnce();
|
||||||
expect(vm.isLoading).toBe(false);
|
expect(vm.isLoading).toBe(false);
|
||||||
expect(vm.hasChanges).toBe(false);
|
expect(vm.hasChanges).toBe(false);
|
||||||
|
@ -229,13 +235,15 @@ describe('CrudModel', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should use default url if there's not saveFn", async () => {
|
it("should use default url if there's not saveFn", async () => {
|
||||||
const postMock =vi.spyOn(axios, 'post');
|
const postMock = vi.spyOn(axios, 'post');
|
||||||
|
|
||||||
vm.formData = [{
|
vm.formData = [
|
||||||
name: 'Bruce',
|
{
|
||||||
lastName: 'Wayne',
|
name: 'Bruce',
|
||||||
age: 45,
|
lastName: 'Wayne',
|
||||||
}]
|
age: 45,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
await vm.saveChanges(data);
|
await vm.saveChanges(data);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import { default as axios } from 'axios';
|
||||||
import EditForm from 'components/EditTableCellValueForm.vue';
|
import EditForm from 'components/EditTableCellValueForm.vue';
|
||||||
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import { default as axios } from 'axios';
|
||||||
|
|
||||||
import FilterItemForm from 'src/components/FilterItemForm.vue';
|
import FilterItemForm from 'src/components/FilterItemForm.vue';
|
||||||
import { vi, beforeAll, describe, expect, it } from 'vitest';
|
import { vi, beforeAll, describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
|
@ -38,9 +40,9 @@ describe('FilterItemForm', () => {
|
||||||
{ relation: 'producer', scope: { fields: ['name'] } },
|
{ relation: 'producer', scope: { fields: ['name'] } },
|
||||||
{ relation: 'ink', scope: { fields: ['name'] } },
|
{ relation: 'ink', scope: { fields: ['name'] } },
|
||||||
],
|
],
|
||||||
where: {"name":{"like":"%bolas de madera%"}},
|
where: { name: { like: '%bolas de madera%' } },
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(axios.get).toHaveBeenCalledWith('Items/withName', {
|
expect(axios.get).toHaveBeenCalledWith('Items/withName', {
|
||||||
params: { filter: JSON.stringify(expectedFilter) },
|
params: { filter: JSON.stringify(expectedFilter) },
|
||||||
});
|
});
|
||||||
|
@ -79,4 +81,4 @@ describe('FilterItemForm', () => {
|
||||||
vm.selectItem({ id: 12345 });
|
vm.selectItem({ id: 12345 });
|
||||||
expect(wrapper.emitted('itemSelected')[0]).toEqual([12345]);
|
expect(wrapper.emitted('itemSelected')[0]).toEqual([12345]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { describe, expect, it, beforeAll, vi, afterAll } from 'vitest';
|
import { describe, expect, it, beforeAll, vi, afterAll } from 'vitest';
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import { default as axios } from 'axios';
|
||||||
|
|
||||||
import FormModel from 'src/components/FormModel.vue';
|
import FormModel from 'src/components/FormModel.vue';
|
||||||
|
|
||||||
describe('FormModel', () => {
|
describe('FormModel', () => {
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import { default as axios } from 'axios';
|
||||||
|
|
||||||
import VnDmsList from 'src/components/common/VnDmsList.vue';
|
import VnDmsList from 'src/components/common/VnDmsList.vue';
|
||||||
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
describe('VnDmsList', () => {
|
describe('VnDmsList', () => {
|
||||||
let vm;
|
let vm;
|
||||||
const dms = {
|
const dms = {
|
||||||
userFk: 1,
|
userFk: 1,
|
||||||
name: 'DMS 1'
|
name: 'DMS 1',
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
vi.spyOn(axios, 'get').mockResolvedValue({ data: [] });
|
vi.spyOn(axios, 'get').mockResolvedValue({ data: [] });
|
||||||
vm = createWrapper(VnDmsList, {
|
vm = createWrapper(VnDmsList, {
|
||||||
|
@ -18,8 +20,8 @@ describe('VnDmsList', () => {
|
||||||
filter: 'wd.workerFk',
|
filter: 'wd.workerFk',
|
||||||
updateModel: 'Workers',
|
updateModel: 'Workers',
|
||||||
deleteModel: 'WorkerDms',
|
deleteModel: 'WorkerDms',
|
||||||
downloadModel: 'WorkerDms'
|
downloadModel: 'WorkerDms',
|
||||||
}
|
},
|
||||||
}).vm;
|
}).vm;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -29,46 +31,45 @@ describe('VnDmsList', () => {
|
||||||
|
|
||||||
describe('setData()', () => {
|
describe('setData()', () => {
|
||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
userFk: 1,
|
userFk: 1,
|
||||||
name: 'Jessica',
|
name: 'Jessica',
|
||||||
lastName: 'Jones',
|
lastName: 'Jones',
|
||||||
file: '4.jpg',
|
file: '4.jpg',
|
||||||
created: '2021-07-28 21:00:00'
|
created: '2021-07-28 21:00:00',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
userFk: 2,
|
userFk: 2,
|
||||||
name: 'Bruce',
|
name: 'Bruce',
|
||||||
lastName: 'Banner',
|
lastName: 'Banner',
|
||||||
created: '2022-07-28 21:00:00',
|
created: '2022-07-28 21:00:00',
|
||||||
dms: {
|
dms: {
|
||||||
userFk: 2,
|
userFk: 2,
|
||||||
name: 'Bruce',
|
name: 'Bruce',
|
||||||
lastName: 'BannerDMS',
|
lastName: 'BannerDMS',
|
||||||
created: '2022-07-28 21:00:00',
|
created: '2022-07-28 21:00:00',
|
||||||
file: '4.jpg',
|
file: '4.jpg',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
userFk: 3,
|
userFk: 3,
|
||||||
name: 'Natasha',
|
name: 'Natasha',
|
||||||
lastName: 'Romanoff',
|
lastName: 'Romanoff',
|
||||||
file: '4.jpg',
|
file: '4.jpg',
|
||||||
created: '2021-10-28 21:00:00'
|
created: '2021-10-28 21:00:00',
|
||||||
}
|
},
|
||||||
]
|
];
|
||||||
|
|
||||||
it('Should replace objects that contain the "dms" property with the value of the same and sort by creation date', () => {
|
it('Should replace objects that contain the "dms" property with the value of the same and sort by creation date', () => {
|
||||||
vm.setData(data);
|
vm.setData(data);
|
||||||
expect([vm.rows][0][0].lastName).toEqual('BannerDMS');
|
expect([vm.rows][0][0].lastName).toEqual('BannerDMS');
|
||||||
expect([vm.rows][0][1].lastName).toEqual('Romanoff');
|
expect([vm.rows][0][1].lastName).toEqual('Romanoff');
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('parseDms()', () => {
|
describe('parseDms()', () => {
|
||||||
const resultDms = { ...dms, userId:1};
|
const resultDms = { ...dms, userId: 1 };
|
||||||
|
|
||||||
it('Should add properties that end with "Fk" by changing the suffix to "Id"', () => {
|
it('Should add properties that end with "Fk" by changing the suffix to "Id"', () => {
|
||||||
const parsedDms = vm.parseDms(dms);
|
const parsedDms = vm.parseDms(dms);
|
||||||
expect(parsedDms).toEqual(resultDms);
|
expect(parsedDms).toEqual(resultDms);
|
||||||
|
@ -76,12 +77,12 @@ describe('VnDmsList', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('showFormDialog()', () => {
|
describe('showFormDialog()', () => {
|
||||||
const resultDms = { ...dms, userId:1};
|
const resultDms = { ...dms, userId: 1 };
|
||||||
|
|
||||||
it('should call fn parseDms() and set show true if dms is defined', () => {
|
it('should call fn parseDms() and set show true if dms is defined', () => {
|
||||||
vm.showFormDialog(dms);
|
vm.showFormDialog(dms);
|
||||||
expect(vm.formDialog.show).toEqual(true);
|
expect(vm.formDialog.show).toEqual(true);
|
||||||
expect(vm.formDialog.dms).toEqual(resultDms);
|
expect(vm.formDialog.dms).toEqual(resultDms);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { describe, it, expect, vi, beforeAll, afterEach, beforeEach } from 'vitest';
|
import { describe, it, expect, vi, beforeAll, afterEach, beforeEach } from 'vitest';
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import { default as axios } from 'axios';
|
||||||
|
|
||||||
import VnNotes from 'src/components/ui/VnNotes.vue';
|
import VnNotes from 'src/components/ui/VnNotes.vue';
|
||||||
|
|
||||||
describe('VnNotes', () => {
|
describe('VnNotes', () => {
|
||||||
|
@ -8,26 +10,34 @@ describe('VnNotes', () => {
|
||||||
let spyFetch;
|
let spyFetch;
|
||||||
let postMock;
|
let postMock;
|
||||||
let expectedBody;
|
let expectedBody;
|
||||||
const mockData= {name: 'Tony', lastName: 'Stark', text: 'Test Note', observationTypeFk: 1};
|
const mockData = {
|
||||||
|
name: 'Tony',
|
||||||
|
lastName: 'Stark',
|
||||||
|
text: 'Test Note',
|
||||||
|
observationTypeFk: 1,
|
||||||
|
};
|
||||||
|
|
||||||
function generateExpectedBody() {
|
function generateExpectedBody() {
|
||||||
expectedBody = {...vm.$props.body, ...{ text: vm.newNote.text, observationTypeFk: vm.newNote.observationTypeFk }};
|
expectedBody = {
|
||||||
|
...vm.$props.body,
|
||||||
|
...{ text: vm.newNote.text, observationTypeFk: vm.newNote.observationTypeFk },
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setTestParams(text, observationType, type){
|
async function setTestParams(text, observationType, type) {
|
||||||
vm.newNote.text = text;
|
vm.newNote.text = text;
|
||||||
vm.newNote.observationTypeFk = observationType;
|
vm.newNote.observationTypeFk = observationType;
|
||||||
wrapper.setProps({ selectType: type });
|
wrapper.setProps({ selectType: type });
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
vi.spyOn(axios, 'get').mockReturnValue({ data: [] });
|
vi.spyOn(axios, 'get').mockReturnValue({ data: [] });
|
||||||
|
|
||||||
wrapper = createWrapper(VnNotes, {
|
wrapper = createWrapper(VnNotes, {
|
||||||
propsData: {
|
propsData: {
|
||||||
url: '/test',
|
url: '/test',
|
||||||
body: { name: 'Tony', lastName: 'Stark' },
|
body: { name: 'Tony', lastName: 'Stark' },
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
wrapper = wrapper.wrapper;
|
wrapper = wrapper.wrapper;
|
||||||
vm = wrapper.vm;
|
vm = wrapper.vm;
|
||||||
|
@ -45,7 +55,7 @@ describe('VnNotes', () => {
|
||||||
|
|
||||||
describe('insert', () => {
|
describe('insert', () => {
|
||||||
it('should not call axios.post and vnPaginateRef.fetch if newNote.text is null', async () => {
|
it('should not call axios.post and vnPaginateRef.fetch if newNote.text is null', async () => {
|
||||||
await setTestParams( null, null, true );
|
await setTestParams(null, null, true);
|
||||||
|
|
||||||
await vm.insert();
|
await vm.insert();
|
||||||
|
|
||||||
|
@ -54,7 +64,7 @@ describe('VnNotes', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not call axios.post and vnPaginateRef.fetch if newNote.text is empty', async () => {
|
it('should not call axios.post and vnPaginateRef.fetch if newNote.text is empty', async () => {
|
||||||
await setTestParams( "", null, false );
|
await setTestParams('', null, false);
|
||||||
|
|
||||||
await vm.insert();
|
await vm.insert();
|
||||||
|
|
||||||
|
@ -63,7 +73,7 @@ describe('VnNotes', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not call axios.post and vnPaginateRef.fetch if observationTypeFk is missing and selectType is true', async () => {
|
it('should not call axios.post and vnPaginateRef.fetch if observationTypeFk is missing and selectType is true', async () => {
|
||||||
await setTestParams( "Test Note", null, true );
|
await setTestParams('Test Note', null, true);
|
||||||
|
|
||||||
await vm.insert();
|
await vm.insert();
|
||||||
|
|
||||||
|
@ -72,7 +82,7 @@ describe('VnNotes', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call axios.post and vnPaginateRef.fetch if observationTypeFk is missing and selectType is false', async () => {
|
it('should call axios.post and vnPaginateRef.fetch if observationTypeFk is missing and selectType is false', async () => {
|
||||||
await setTestParams( "Test Note", null, false );
|
await setTestParams('Test Note', null, false);
|
||||||
|
|
||||||
generateExpectedBody();
|
generateExpectedBody();
|
||||||
|
|
||||||
|
@ -82,8 +92,8 @@ describe('VnNotes', () => {
|
||||||
expect(spyFetch).toHaveBeenCalled();
|
expect(spyFetch).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call axios.post and vnPaginateRef.fetch if observationTypeFk is setted and selectType is false', async () => {
|
it('should call axios.post and vnPaginateRef.fetch if observationTypeFk is setted and selectType is false', async () => {
|
||||||
await setTestParams( "Test Note", 1, false );
|
await setTestParams('Test Note', 1, false);
|
||||||
|
|
||||||
generateExpectedBody();
|
generateExpectedBody();
|
||||||
|
|
||||||
|
@ -94,14 +104,14 @@ describe('VnNotes', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call axios.post and vnPaginateRef.fetch when newNote is valid', async () => {
|
it('should call axios.post and vnPaginateRef.fetch when newNote is valid', async () => {
|
||||||
await setTestParams( "Test Note", 1, true );
|
await setTestParams('Test Note', 1, true);
|
||||||
|
|
||||||
generateExpectedBody();
|
generateExpectedBody();
|
||||||
|
|
||||||
await vm.insert();
|
await vm.insert();
|
||||||
|
|
||||||
expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedBody);
|
expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedBody);
|
||||||
expect(spyFetch).toHaveBeenCalled();
|
expect(spyFetch).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { vi, describe, expect, it, beforeAll, afterEach, beforeEach } from 'vitest';
|
import { vi, describe, expect, it, beforeAll, afterEach, beforeEach } from 'vitest';
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import { default as axios } from 'axios';
|
||||||
|
|
||||||
import CardSummary from 'src/components/ui/CardSummary.vue';
|
import CardSummary from 'src/components/ui/CardSummary.vue';
|
||||||
import * as vueRouter from 'vue-router';
|
import * as vueRouter from 'vue-router';
|
||||||
|
|
||||||
|
@ -72,7 +74,7 @@ describe('CardSummary', () => {
|
||||||
expect(vm.store.filter).toEqual({ key: newKey });
|
expect(vm.store.filter).toEqual({ key: newKey });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return true if route path ends with /summary' , () => {
|
it('should return true if route path ends with /summary', () => {
|
||||||
expect(vm.isSummary).toBe(true);
|
expect(vm.isSummary).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -60,7 +60,7 @@ export function useSession() {
|
||||||
const { data: isValidToken } = await axios.get('VnUsers/validateToken');
|
const { data: isValidToken } = await axios.get('VnUsers/validateToken');
|
||||||
if (isValidToken)
|
if (isValidToken)
|
||||||
destroyTokenPromises = Object.entries(tokens).map(([key, url]) =>
|
destroyTokenPromises = Object.entries(tokens).map(([key, url]) =>
|
||||||
destroyToken(url, storage, key)
|
destroyToken(url, storage, key),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -61,7 +61,7 @@ watch(
|
||||||
() => {
|
() => {
|
||||||
claimDmsFilter.value.where.id = router.currentRoute.value.params.id;
|
claimDmsFilter.value.where.id = router.currentRoute.value.params.id;
|
||||||
claimDmsRef.value.fetch();
|
claimDmsRef.value.fetch();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
function openDialog(dmsId) {
|
function openDialog(dmsId) {
|
||||||
|
|
|
@ -40,8 +40,6 @@ vi.mock('vue-router', () => ({
|
||||||
onBeforeRouteLeave: () => {},
|
onBeforeRouteLeave: () => {},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock('axios');
|
|
||||||
|
|
||||||
vi.spyOn(useValidator, 'useValidator').mockImplementation(() => {
|
vi.spyOn(useValidator, 'useValidator').mockImplementation(() => {
|
||||||
return {
|
return {
|
||||||
validate: vi.fn(),
|
validate: vi.fn(),
|
||||||
|
|
Loading…
Reference in New Issue