refactor: await rejections on tests
This commit is contained in:
@@ -71,6 +71,6 @@ describe('EstablishmentDAO', () => {
|
|||||||
sqlite.executeQuery = vi.fn().mockResolvedValue({ rows: [] });
|
sqlite.executeQuery = vi.fn().mockResolvedValue({ rows: [] });
|
||||||
ESTABLISHMENT_MOCK.id = undefined;
|
ESTABLISHMENT_MOCK.id = undefined;
|
||||||
ESTABLISHMENT_MOCK.chain.id = undefined;
|
ESTABLISHMENT_MOCK.chain.id = undefined;
|
||||||
expect(service.insert(ESTABLISHMENT_MOCK)).rejects.toThrow();
|
await expect(service.insert(ESTABLISHMENT_MOCK)).rejects.toThrow();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -74,13 +74,13 @@ describe('ProductEstablishmentDAO', () => {
|
|||||||
it('should throw if toDB is called with a product that has no id', async () => {
|
it('should throw if toDB is called with a product that has no id', async () => {
|
||||||
sqlite.executeQuery = vi.fn().mockResolvedValue({ rows: [] });
|
sqlite.executeQuery = vi.fn().mockResolvedValue({ rows: [] });
|
||||||
PRODUCT_ESTABLISHMENT_MOCK.product.id = undefined;
|
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 () => {
|
it('should throw if toDB is called with a establishmen that has no id', async () => {
|
||||||
sqlite.executeQuery = vi.fn().mockResolvedValue({ rows: [] });
|
sqlite.executeQuery = vi.fn().mockResolvedValue({ rows: [] });
|
||||||
PRODUCT_ESTABLISHMENT_MOCK.establishment.id = undefined;
|
PRODUCT_ESTABLISHMENT_MOCK.establishment.id = undefined;
|
||||||
expect(service.insert(PRODUCT_ESTABLISHMENT_MOCK)).rejects.toThrow();
|
await expect(service.insert(PRODUCT_ESTABLISHMENT_MOCK)).rejects.toThrow();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -83,13 +83,13 @@ describe('PurchaseDAO', () => {
|
|||||||
it('should throw if toDB is called with a establishmen that has no id', async () => {
|
it('should throw if toDB is called with a establishmen that has no id', async () => {
|
||||||
sqlite.executeQuery = vi.fn().mockResolvedValue({ rows: [] });
|
sqlite.executeQuery = vi.fn().mockResolvedValue({ rows: [] });
|
||||||
PURCHASE_MOCK.establishment.id = undefined;
|
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 () => {
|
it('should throw if toDB is called with a product that has no id', async () => {
|
||||||
sqlite.executeQuery = vi.fn().mockResolvedValue({ rows: [] });
|
sqlite.executeQuery = vi.fn().mockResolvedValue({ rows: [] });
|
||||||
PURCHASE_MOCK.product.id = undefined;
|
PURCHASE_MOCK.product.id = undefined;
|
||||||
expect(service.insert(PURCHASE_MOCK)).rejects.toThrow();
|
await expect(service.insert(PURCHASE_MOCK)).rejects.toThrow();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user