test: refs #8647 fix warning

This commit is contained in:
Javier Segarra 2025-02-28 09:42:11 +01:00
parent 29cd014ec8
commit a6777cc183
6 changed files with 34 additions and 18 deletions

View File

@ -4,7 +4,7 @@ import VnDiscount from 'components/common/vnDiscount.vue';
describe('VnDiscount', () => {
let vm;
beforeAll(() => {
vm = createWrapper(VnDiscount, {
props: {
@ -12,7 +12,9 @@ describe('VnDiscount', () => {
price: 100,
quantity: 2,
discount: 10,
}
mana: 10,
promise: vi.fn(),
},
}).vm;
});
@ -21,8 +23,8 @@ describe('VnDiscount', () => {
});
describe('total', () => {
it('should calculate total correctly', () => {
it('should calculate total correctly', () => {
expect(vm.total).toBe(180);
});
});
});
});

View File

@ -23,7 +23,7 @@ const claimDms = ref([
]);
const client = ref({});
const inputFile = ref();
const files = ref({});
const files = ref([]);
const spinnerRef = ref();
const claimDmsRef = ref();
const dmsType = ref({});
@ -252,9 +252,8 @@ function onDrag() {
icon="add"
color="primary"
>
<QInput
<QFile
ref="inputFile"
type="file"
style="display: none"
multiple
v-model="files"

View File

@ -1,6 +1,7 @@
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;
@ -12,6 +13,9 @@ describe('ClaimLines', () => {
mocks: {
fetch: vi.fn(),
},
directives: {
shortcut: keyShortcut,
},
},
}).vm;
});
@ -51,7 +55,7 @@ describe('ClaimLines', () => {
expectedData,
{
signal: canceller.signal,
}
},
);
});
});
@ -68,7 +72,7 @@ describe('ClaimLines', () => {
expect.objectContaining({
message: 'Discount updated',
type: 'positive',
})
}),
);
});
});

View File

@ -1,4 +1,4 @@
import { vi, describe, expect, it, beforeAll, beforeEach, afterEach } from 'vitest';
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import ClaimLinesImport from 'pages/Claim/Card/ClaimLinesImport.vue';
@ -13,6 +13,9 @@ describe('ClaimLinesImport', () => {
fetch: vi.fn(),
},
},
propsData: {
ticketId: 1,
},
}).vm;
});
@ -39,7 +42,7 @@ describe('ClaimLinesImport', () => {
expect.objectContaining({
message: 'Lines added to claim',
type: 'positive',
})
}),
);
expect(vm.canceller).toEqual(null);
});

View File

@ -1,6 +1,7 @@
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;
@ -25,6 +26,9 @@ describe('ClaimPhoto', () => {
mocks: {
fetch: vi.fn(),
},
directives: {
shortcut: keyShortcut,
},
},
}).vm;
});
@ -41,10 +45,10 @@ describe('ClaimPhoto', () => {
await vm.deleteDms({ index: 0 });
expect(axios.post).toHaveBeenCalledWith(
`ClaimDms/${claimMock.claimDms[0].dmsFk}/removeFile`
`ClaimDms/${claimMock.claimDms[0].dmsFk}/removeFile`,
);
expect(vm.quasar.notify).toHaveBeenCalledWith(
expect.objectContaining({ type: 'positive' })
expect.objectContaining({ type: 'positive' }),
);
});
});
@ -61,9 +65,9 @@ describe('ClaimPhoto', () => {
title: 'This file will be deleted',
icon: 'delete',
data: { index: 1 },
promise: vm.deleteDms
promise: vm.deleteDms,
},
})
}),
);
});
});
@ -102,10 +106,10 @@ describe('ClaimPhoto', () => {
new FormData(),
expect.objectContaining({
params: expect.objectContaining({ hasFile: false }),
})
}),
);
expect(vm.quasar.notify).toHaveBeenCalledWith(
expect.objectContaining({ type: 'positive' })
expect.objectContaining({ type: 'positive' }),
);
expect(vm.claimDmsRef.fetch).toHaveBeenCalledOnce();

View File

@ -1,6 +1,7 @@
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;
@ -12,6 +13,9 @@ describe('CustomerPayments', () => {
mocks: {
fetch: vi.fn(),
},
directives: {
shortcut: keyShortcut,
},
},
}).vm;
});
@ -31,7 +35,7 @@ describe('CustomerPayments', () => {
expect.objectContaining({
message: 'Payment confirmed',
type: 'positive',
})
}),
);
});
});