From ecd1b922eff4d6fac45d9ca73ee60325118b50f6 Mon Sep 17 00:00:00 2001 From: Samuel Date: Sat, 24 Aug 2024 00:43:35 +0200 Subject: [PATCH] test: fix timing in test case --- test/unit/service/report-service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/unit/service/report-service.ts b/test/unit/service/report-service.ts index 1401362da..71eb8de87 100644 --- a/test/unit/service/report-service.ts +++ b/test/unit/service/report-service.ts @@ -490,9 +490,9 @@ describe('ReportService', () => { it('should return the total expenditure of a user with mixed transactions before and after the tillDate', async () => { await inUserContext((await UserFactory()).clone(2), async (debtor: User, creditor: User) => { - const tillDate = new Date(new Date().getTime() + 1500); // Set tillDate to 1.5 seconds after current time - await createTransactions(debtor.id, creditor.id, 2, 2000); // Transactions 2 seconds in the future (after tillDate) - const transactions = await createTransactions(debtor.id, creditor.id, 3, 1000); // Transactions 1 second in the future (before tillDate) + const transactions = await createTransactions(debtor.id, creditor.id, 3); + const tillDate = new Date(); + await createTransactions(debtor.id, creditor.id, 2); await checkTransactionsBuyerReport(transactions.transactions, { fromDate: new Date(2000, 0, 0), tillDate,