From d153cc9c24bb7c525dbbe539fe4550b769e9b313 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 23 May 2024 14:19:39 +0200 Subject: [PATCH] fix: refs #6942 unit tests --- .../InvoiceIn/InvoiceInBasicData.spec.js | 34 ------------------- .../InvoiceIn/InvoiceInIntrastat.spec.js | 6 ++-- 2 files changed, 3 insertions(+), 37 deletions(-) delete mode 100644 test/vitest/__tests__/pages/InvoiceIn/InvoiceInBasicData.spec.js diff --git a/test/vitest/__tests__/pages/InvoiceIn/InvoiceInBasicData.spec.js b/test/vitest/__tests__/pages/InvoiceIn/InvoiceInBasicData.spec.js deleted file mode 100644 index a3c383f74..000000000 --- a/test/vitest/__tests__/pages/InvoiceIn/InvoiceInBasicData.spec.js +++ /dev/null @@ -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', - }) - ); - }); - }); -}); diff --git a/test/vitest/__tests__/pages/InvoiceIn/InvoiceInIntrastat.spec.js b/test/vitest/__tests__/pages/InvoiceIn/InvoiceInIntrastat.spec.js index 55ca19d71..adfb054c6 100644 --- a/test/vitest/__tests__/pages/InvoiceIn/InvoiceInIntrastat.spec.js +++ b/test/vitest/__tests__/pages/InvoiceIn/InvoiceInIntrastat.spec.js @@ -19,13 +19,13 @@ describe('InvoiceInIntrastat', () => { describe('getTotal()', () => { it('should correctly handle the sum', () => { - vm.invoceInIntrastat = [ + const invoceInIntrastat = [ { amount: 10, stems: 162 }, { amount: 20, stems: 21 }, ]; - const totalAmount = vm.getTotal('amount'); - const totalStems = vm.getTotal('stems'); + const totalAmount = vm.getTotal(invoceInIntrastat, 'amount'); + const totalStems = vm.getTotal(invoceInIntrastat, 'stems'); expect(totalAmount).toBe(10 + 20); expect(totalStems).toBe(162 + 21);