0
0
Fork 0

test: refs #6919 fix tests

This commit is contained in:
Jorge Penadés 2025-01-30 17:28:03 +01:00
parent f26290a952
commit d5373ecbd6
2 changed files with 5 additions and 9 deletions

View File

@ -93,7 +93,7 @@ describe('FormModel', () => {
it('should call axios.patch with the right data', async () => { it('should call axios.patch with the right data', async () => {
const spy = vi.spyOn(axios, 'patch').mockResolvedValue({ data: {} }); const spy = vi.spyOn(axios, 'patch').mockResolvedValue({ data: {} });
const { vm } = mount({ propsData: { url, model, formInitialData } }); const { vm } = mount({ propsData: { url, model } });
vm.formData.mockKey = 'newVal'; vm.formData.mockKey = 'newVal';
await vm.$nextTick(); await vm.$nextTick();
await vm.save(); await vm.save();
@ -106,6 +106,7 @@ describe('FormModel', () => {
const { vm } = mount({ const { vm } = mount({
propsData: { url, model, formInitialData, urlCreate: 'mockUrlCreate' }, propsData: { url, model, formInitialData, urlCreate: 'mockUrlCreate' },
}); });
await vm.$nextTick();
vm.formData.mockKey = 'newVal'; vm.formData.mockKey = 'newVal';
await vm.$nextTick(); await vm.$nextTick();
await vm.save(); await vm.save();
@ -119,7 +120,7 @@ describe('FormModel', () => {
}); });
const spyPatch = vi.spyOn(axios, 'patch').mockResolvedValue({ data: {} }); const spyPatch = vi.spyOn(axios, 'patch').mockResolvedValue({ data: {} });
const spySaveFn = vi.spyOn(vm.$props, 'saveFn'); const spySaveFn = vi.spyOn(vm.$props, 'saveFn');
await vm.$nextTick();
vm.formData.mockKey = 'newVal'; vm.formData.mockKey = 'newVal';
await vm.$nextTick(); await vm.$nextTick();
await vm.save(); await vm.save();

View File

@ -56,11 +56,6 @@ describe('CardSummary', () => {
expect(vm.entity).toEqual({ id: 1, name: 'Entity 1' }); expect(vm.entity).toEqual({ id: 1, name: 'Entity 1' });
}); });
it('should handle empty data gracefully', () => {
vm.store.data = [];
expect(vm.entity).toBeUndefined();
});
it('should respond to prop changes and refetch data', async () => { it('should respond to prop changes and refetch data', async () => {
const newUrl = 'CardSummary/35'; const newUrl = 'CardSummary/35';
const newKey = 'cardSummaryKey/35'; const newKey = 'cardSummaryKey/35';
@ -72,7 +67,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);
}); });
}); });