From ae5b745f5c81062e57b3736904e4972b68ae476d Mon Sep 17 00:00:00 2001 From: Mir Arif Hasan Date: Tue, 8 Apr 2025 21:02:01 +0600 Subject: [PATCH] test(backend): account for race conditions in `verifyMagicLinkTokens` test suite (#4969) --- packages/hoppscotch-backend/src/auth/auth.service.spec.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/hoppscotch-backend/src/auth/auth.service.spec.ts b/packages/hoppscotch-backend/src/auth/auth.service.spec.ts index 91e636fc..75a6ba7a 100644 --- a/packages/hoppscotch-backend/src/auth/auth.service.spec.ts +++ b/packages/hoppscotch-backend/src/auth/auth.service.spec.ts @@ -213,9 +213,10 @@ describe('verifyMagicLinkTokens', () => { test('Should throw MAGIC_LINK_EXPIRED if passwordless token is expired', async () => { // validatePasswordlessTokens - mockPrisma.verificationToken.findUniqueOrThrow.mockResolvedValueOnce( - passwordlessData, - ); + mockPrisma.verificationToken.findUniqueOrThrow.mockResolvedValueOnce({ + ...passwordlessData, + expiresOn: new Date('2020-01-01T00:00:00Z'), + }); // findUserById mockUser.findUserById.mockResolvedValue(O.some(user)); // checkIfProviderAccountExists