From d4723e6a244744ba7adc3e9f39dd8a3785217d7e Mon Sep 17 00:00:00 2001 From: Gabriel De Los Rios Date: Sat, 7 Feb 2026 23:27:20 -0300 Subject: [PATCH] refactor: await rejections on tests --- src/app/dao/EstablishmentDAO.spec.ts | 2 +- src/app/dao/ProductEstablishmentDAO.spec.ts | 4 ++-- src/app/dao/PurchaseDAO.spec.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/dao/EstablishmentDAO.spec.ts b/src/app/dao/EstablishmentDAO.spec.ts index edfb788..eb5e725 100644 --- a/src/app/dao/EstablishmentDAO.spec.ts +++ b/src/app/dao/EstablishmentDAO.spec.ts @@ -71,6 +71,6 @@ describe('EstablishmentDAO', () => { sqlite.executeQuery = vi.fn().mockResolvedValue({ rows: [] }); ESTABLISHMENT_MOCK.id = undefined; ESTABLISHMENT_MOCK.chain.id = undefined; - expect(service.insert(ESTABLISHMENT_MOCK)).rejects.toThrow(); + await expect(service.insert(ESTABLISHMENT_MOCK)).rejects.toThrow(); }); }); diff --git a/src/app/dao/ProductEstablishmentDAO.spec.ts b/src/app/dao/ProductEstablishmentDAO.spec.ts index c0273f7..2abf0fa 100644 --- a/src/app/dao/ProductEstablishmentDAO.spec.ts +++ b/src/app/dao/ProductEstablishmentDAO.spec.ts @@ -74,13 +74,13 @@ describe('ProductEstablishmentDAO', () => { it('should throw if toDB is called with a product that has no id', async () => { sqlite.executeQuery = vi.fn().mockResolvedValue({ rows: [] }); PRODUCT_ESTABLISHMENT_MOCK.product.id = undefined; - expect(service.insert(PRODUCT_ESTABLISHMENT_MOCK)).rejects.toThrow(); + await expect(service.insert(PRODUCT_ESTABLISHMENT_MOCK)).rejects.toThrow(); }); it('should throw if toDB is called with a establishmen that has no id', async () => { sqlite.executeQuery = vi.fn().mockResolvedValue({ rows: [] }); PRODUCT_ESTABLISHMENT_MOCK.establishment.id = undefined; - expect(service.insert(PRODUCT_ESTABLISHMENT_MOCK)).rejects.toThrow(); + await expect(service.insert(PRODUCT_ESTABLISHMENT_MOCK)).rejects.toThrow(); }); }); }); diff --git a/src/app/dao/PurchaseDAO.spec.ts b/src/app/dao/PurchaseDAO.spec.ts index 575ea45..a926dde 100644 --- a/src/app/dao/PurchaseDAO.spec.ts +++ b/src/app/dao/PurchaseDAO.spec.ts @@ -83,13 +83,13 @@ describe('PurchaseDAO', () => { it('should throw if toDB is called with a establishmen that has no id', async () => { sqlite.executeQuery = vi.fn().mockResolvedValue({ rows: [] }); PURCHASE_MOCK.establishment.id = undefined; - expect(service.insert(PURCHASE_MOCK)).rejects.toThrow(); + await expect(service.insert(PURCHASE_MOCK)).rejects.toThrow(); }); it('should throw if toDB is called with a product that has no id', async () => { sqlite.executeQuery = vi.fn().mockResolvedValue({ rows: [] }); PURCHASE_MOCK.product.id = undefined; - expect(service.insert(PURCHASE_MOCK)).rejects.toThrow(); + await expect(service.insert(PURCHASE_MOCK)).rejects.toThrow(); }); }); });