Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

test(backend): account for race conditions in `verifyMagicLinkTokens` test suite (#4969)

Mir Arif Hasanae5b745f5c81
diff --git a/packages/hoppscotch-backend/src/auth/auth.service.spec.ts b/packages/hoppscotch-backend/src/auth/auth.service.spec.ts
index 91e636fc8..75a6ba7ab 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