feat: refs #8647 updates
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
539fc81ffa
commit
0ee939d568
|
@ -1,6 +1,5 @@
|
|||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||
import CrudModel from 'components/CrudModel.vue';
|
||||
import keyShortcut from 'src/boot/keyShortcut';
|
||||
import { vi, afterEach, beforeEach, beforeAll, describe, expect, it } from 'vitest';
|
||||
|
||||
describe('CrudModel', () => {
|
||||
|
@ -10,20 +9,10 @@ describe('CrudModel', () => {
|
|||
beforeAll(() => {
|
||||
wrapper = createWrapper(CrudModel, {
|
||||
global: {
|
||||
stubs: [
|
||||
'vnPaginate',
|
||||
'useState',
|
||||
'arrayData',
|
||||
'useStateStore',
|
||||
'vue-i18n',
|
||||
'RouterLink',
|
||||
],
|
||||
stubs: ['vnPaginate', 'vue-i18n'],
|
||||
mocks: {
|
||||
validate: vi.fn(),
|
||||
},
|
||||
directives: {
|
||||
shortcut: keyShortcut,
|
||||
},
|
||||
},
|
||||
propsData: {
|
||||
dataRequired: {
|
||||
|
@ -34,9 +23,6 @@ describe('CrudModel', () => {
|
|||
url: 'crudModelUrl',
|
||||
saveFn: '',
|
||||
},
|
||||
directives: {
|
||||
shortcut: keyShortcut, // Registrar la directiva en los tests
|
||||
},
|
||||
});
|
||||
wrapper = wrapper.wrapper;
|
||||
vm = wrapper.vm;
|
||||
|
|
|
@ -4,11 +4,11 @@ import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
|||
|
||||
describe('VnDmsList', () => {
|
||||
let vm;
|
||||
const dms = {
|
||||
userFk: 1,
|
||||
name: 'DMS 1'
|
||||
const dms = {
|
||||
userFk: 1,
|
||||
name: 'DMS 1',
|
||||
};
|
||||
|
||||
|
||||
beforeAll(() => {
|
||||
vi.spyOn(axios, 'get').mockResolvedValue({ data: [] });
|
||||
vm = createWrapper(VnDmsList, {
|
||||
|
@ -18,8 +18,8 @@ describe('VnDmsList', () => {
|
|||
filter: 'wd.workerFk',
|
||||
updateModel: 'Workers',
|
||||
deleteModel: 'WorkerDms',
|
||||
downloadModel: 'WorkerDms'
|
||||
}
|
||||
downloadModel: 'WorkerDms',
|
||||
},
|
||||
}).vm;
|
||||
});
|
||||
|
||||
|
@ -29,46 +29,45 @@ describe('VnDmsList', () => {
|
|||
|
||||
describe('setData()', () => {
|
||||
const data = [
|
||||
{
|
||||
userFk: 1,
|
||||
{
|
||||
userFk: 1,
|
||||
name: 'Jessica',
|
||||
lastName: 'Jones',
|
||||
file: '4.jpg',
|
||||
created: '2021-07-28 21:00:00'
|
||||
created: '2021-07-28 21:00:00',
|
||||
},
|
||||
{
|
||||
userFk: 2,
|
||||
{
|
||||
userFk: 2,
|
||||
name: 'Bruce',
|
||||
lastName: 'Banner',
|
||||
created: '2022-07-28 21:00:00',
|
||||
dms: {
|
||||
userFk: 2,
|
||||
userFk: 2,
|
||||
name: 'Bruce',
|
||||
lastName: 'BannerDMS',
|
||||
created: '2022-07-28 21:00:00',
|
||||
file: '4.jpg',
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
userFk: 3,
|
||||
name: 'Natasha',
|
||||
lastName: 'Romanoff',
|
||||
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', () => {
|
||||
vm.setData(data);
|
||||
expect([vm.rows][0][0].lastName).toEqual('BannerDMS');
|
||||
expect([vm.rows][0][1].lastName).toEqual('Romanoff');
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
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"', () => {
|
||||
const parsedDms = vm.parseDms(dms);
|
||||
expect(parsedDms).toEqual(resultDms);
|
||||
|
@ -76,12 +75,12 @@ describe('VnDmsList', () => {
|
|||
});
|
||||
|
||||
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', () => {
|
||||
vm.showFormDialog(dms);
|
||||
expect(vm.formDialog.show).toEqual(true);
|
||||
expect(vm.formDialog.dms).toEqual(resultDms);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -22,7 +22,6 @@ describe('CardSummary', () => {
|
|||
beforeEach(() => {
|
||||
wrapper = createWrapper(CardSummary, {
|
||||
global: {
|
||||
stubs: ['RouterLink'],
|
||||
mocks: {
|
||||
validate: vi.fn(),
|
||||
},
|
||||
|
|
|
@ -11,8 +11,6 @@ describe('VnSearchbar', () => {
|
|||
|
||||
beforeEach(async () => {
|
||||
wrapper = createWrapper(VnSearchbar, {
|
||||
global: { stubs: ['RouterLink'] },
|
||||
|
||||
propsData: {
|
||||
dataKey: 'testKey',
|
||||
filter: null,
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
export function showResultsAsTable(dialog, results, key) {
|
||||
const quasar = useQuasar();
|
||||
const { t } = useI18n();
|
||||
function openTable() {
|
||||
quasar.notify({
|
||||
message: t('negative.detail.modal.changeItem.success'),
|
||||
color: 'positive',
|
||||
actions: [
|
||||
{
|
||||
label: t('globals.ok'),
|
||||
color: 'white',
|
||||
handler: () => {
|
||||
quasar.dialog({
|
||||
component: dialog,
|
||||
componentProps: {
|
||||
results,
|
||||
key,
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
return { openTable };
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
import { vi, describe, expect, it, beforeAll, beforeEach, afterEach } from 'vitest';
|
||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||
import ClaimLines from '/src/pages/Claim/Card/ClaimLines.vue';
|
||||
import keyShortcut from 'src/boot/keyShortcut';
|
||||
|
||||
describe('ClaimLines', () => {
|
||||
let vm;
|
||||
|
@ -13,9 +12,6 @@ describe('ClaimLines', () => {
|
|||
mocks: {
|
||||
fetch: vi.fn(),
|
||||
},
|
||||
directives: {
|
||||
shortcut: keyShortcut,
|
||||
},
|
||||
},
|
||||
}).vm;
|
||||
});
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||
import ClaimPhoto from 'pages/Claim/Card/ClaimPhoto.vue';
|
||||
import keyShortcut from 'src/boot/keyShortcut';
|
||||
|
||||
describe('ClaimPhoto', () => {
|
||||
let vm;
|
||||
|
@ -26,9 +25,6 @@ describe('ClaimPhoto', () => {
|
|||
mocks: {
|
||||
fetch: vi.fn(),
|
||||
},
|
||||
directives: {
|
||||
shortcut: keyShortcut,
|
||||
},
|
||||
},
|
||||
}).vm;
|
||||
});
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||
import CustomerPayments from 'src/pages/Customer/Payments/CustomerPayments.vue';
|
||||
import keyShortcut from 'src/boot/keyShortcut';
|
||||
|
||||
describe('CustomerPayments', () => {
|
||||
let vm;
|
||||
|
@ -13,9 +12,6 @@ describe('CustomerPayments', () => {
|
|||
mocks: {
|
||||
fetch: vi.fn(),
|
||||
},
|
||||
directives: {
|
||||
shortcut: keyShortcut,
|
||||
},
|
||||
},
|
||||
}).vm;
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@ import Login from 'pages/Login/LoginMain.vue';
|
|||
describe('Login', () => {
|
||||
let vm;
|
||||
beforeAll(() => {
|
||||
vm = createWrapper(Login, { global: { stubs: ['RouterLink'] } }).vm;
|
||||
vm = createWrapper(Login).vm;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
|
|
@ -106,6 +106,7 @@ export function createWrapper(component, options) {
|
|||
directives: {
|
||||
shortcut: keyShortcut,
|
||||
},
|
||||
stubs: ['useState', 'arrayData', 'useStateStore', 'vue-i18n', 'RouterLink'],
|
||||
},
|
||||
mocks: {
|
||||
t: (tKey) => tKey,
|
||||
|
@ -113,15 +114,11 @@ export function createWrapper(component, options) {
|
|||
},
|
||||
};
|
||||
|
||||
const mountOptions = Object.assign({}, defaultOptions);
|
||||
|
||||
if (options instanceof Object) {
|
||||
Object.assign(mountOptions, options);
|
||||
|
||||
if (options.global) {
|
||||
mountOptions.global.plugins = defaultOptions.global.plugins;
|
||||
}
|
||||
}
|
||||
const mountOptions = {
|
||||
...defaultOptions,
|
||||
...options,
|
||||
global: { ...defaultOptions.global, ...options?.global },
|
||||
};
|
||||
|
||||
const wrapper = mount(component, mountOptions);
|
||||
const vm = wrapper.vm;
|
||||
|
|
Loading…
Reference in New Issue