From 1b413e2f471b0ee0bdc00fdfe16c5e4bcfb84a21 Mon Sep 17 00:00:00 2001 From: Mir Arif Hasan Date: Wed, 24 May 2023 02:32:39 +0600 Subject: [PATCH] fix: timing dependency on test case (#3070) --- .../src/user-history/user-history.service.spec.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/hoppscotch-backend/src/user-history/user-history.service.spec.ts b/packages/hoppscotch-backend/src/user-history/user-history.service.spec.ts index 2d6b7b0cfb..3fdc261a8c 100644 --- a/packages/hoppscotch-backend/src/user-history/user-history.service.spec.ts +++ b/packages/hoppscotch-backend/src/user-history/user-history.service.spec.ts @@ -360,13 +360,15 @@ describe('UserHistoryService', () => { }); describe('removeRequestFromHistory', () => { test('Should resolve right and delete request from users history', async () => { + const executedOn = new Date(); + mockPrisma.userHistory.delete.mockResolvedValueOnce({ userUid: 'abc', id: '1', request: [{}], responseMetadata: [{}], reqType: ReqType.REST, - executedOn: new Date(), + executedOn: executedOn, isStarred: false, }); @@ -376,7 +378,7 @@ describe('UserHistoryService', () => { request: JSON.stringify([{}]), responseMetadata: JSON.stringify([{}]), reqType: ReqType.REST, - executedOn: new Date(), + executedOn: executedOn, isStarred: false, }; @@ -384,7 +386,7 @@ describe('UserHistoryService', () => { await userHistoryService.removeRequestFromHistory('abc', '1'), ).toEqualRight(userHistory); }); - test('Should resolve left and error out when req id is invalid ', async () => { + test('Should resolve left and error out when req id is invalid', async () => { mockPrisma.userHistory.delete.mockResolvedValueOnce(null); return expect(