#6942 improve invoiceIn #220
|
@ -1,34 +0,0 @@
|
||||||
import { vi, describe, expect, it, beforeAll } from 'vitest';
|
|
||||||
|
|||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
|
||||||
import InvoiceInBasicData from 'src/pages/InvoiceIn/Card/InvoiceInBasicData.vue';
|
|
||||||
|
|
||||||
describe('InvoiceInBasicData', () => {
|
|
||||||
let vm;
|
|
||||||
|
|
||||||
beforeAll(() => {
|
|
||||||
vm = createWrapper(InvoiceInBasicData, {
|
|
||||||
global: {
|
|
||||||
stubs: [],
|
|
||||||
mocks: {
|
|
||||||
fetch: vi.fn(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}).vm;
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('upsert()', () => {
|
|
||||||
it('should throw an error when data is empty', async () => {
|
|
||||||
vi.spyOn(axios, 'post').mockResolvedValue({ data: [] });
|
|
||||||
vi.spyOn(vm.quasar, 'notify');
|
|
||||||
|
|
||||||
await vm.upsert();
|
|
||||||
|
|
||||||
expect(vm.quasar.notify).toHaveBeenCalledWith(
|
|
||||||
expect.objectContaining({
|
|
||||||
message: `The company can't be empty`,
|
|
||||||
type: 'negative',
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -19,13 +19,13 @@ describe('InvoiceInIntrastat', () => {
|
||||||
|
|
||||||
describe('getTotal()', () => {
|
describe('getTotal()', () => {
|
||||||
it('should correctly handle the sum', () => {
|
it('should correctly handle the sum', () => {
|
||||||
vm.invoceInIntrastat = [
|
const invoceInIntrastat = [
|
||||||
jorgep
commented
Ahora a la fn hay que pasarle el array. Así los valoraes se actualizan de forma reactiva. Ahora a la fn hay que pasarle el array. Así los valoraes se actualizan de forma reactiva.
|
|||||||
{ amount: 10, stems: 162 },
|
{ amount: 10, stems: 162 },
|
||||||
{ amount: 20, stems: 21 },
|
{ amount: 20, stems: 21 },
|
||||||
];
|
];
|
||||||
|
|
||||||
const totalAmount = vm.getTotal('amount');
|
const totalAmount = vm.getTotal(invoceInIntrastat, 'amount');
|
||||||
const totalStems = vm.getTotal('stems');
|
const totalStems = vm.getTotal(invoceInIntrastat, 'stems');
|
||||||
|
|
||||||
expect(totalAmount).toBe(10 + 20);
|
expect(totalAmount).toBe(10 + 20);
|
||||||
expect(totalStems).toBe(162 + 21);
|
expect(totalStems).toBe(162 + 21);
|
||||||
|
|
Loading…
Reference in New Issue
Ya se comprueba en e2e