[PR #4969] [MERGED] test(backend): account for race conditions in verifyMagicLinkTokens test suite #5006

Closed
opened 2026-03-17 02:29:44 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/4969
Author: @mirarifhasan
Created: 4/8/2025
Status: Merged
Merged: 4/8/2025
Merged by: @jamesgeorge007

Base: patchHead: fix/auth-test-case


📝 Commits (1)

  • 5dcda05 test: verifyMagicLinkTokens test case fix

📊 Changes

1 file changed (+4 additions, -3 deletions)

View changed files

📝 packages/hoppscotch-backend/src/auth/auth.service.spec.ts (+4 -3)

📄 Description

Closes #4964

What's changed

This PR fixes a test case for the verifyMagicLinkTokens function.
The test case was related to a timestamp issue, which is difficult to reproduce unless the test runs on a very fast machine.

Explanatiton

Most of the time when we run the tests, expiresOn becomes slightly outdated by the time and the test function passes.
Whenever you use a fast machine, expiresOn may hold the current time, which can trigger an error in subsequent functions.

Notes to reviewers

Nil

How to Test

Just run the followed cmds

cd packages/hoppscotch-backend
pnpm run test

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/4969 **Author:** [@mirarifhasan](https://github.com/mirarifhasan) **Created:** 4/8/2025 **Status:** ✅ Merged **Merged:** 4/8/2025 **Merged by:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Base:** `patch` ← **Head:** `fix/auth-test-case` --- ### 📝 Commits (1) - [`5dcda05`](https://github.com/hoppscotch/hoppscotch/commit/5dcda0583f48105cfc252fd21a4a5cd75fc884ef) test: verifyMagicLinkTokens test case fix ### 📊 Changes **1 file changed** (+4 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-backend/src/auth/auth.service.spec.ts` (+4 -3) </details> ### 📄 Description <!-- Thanks for creating this pull request 🤗 Please make sure that the pull request is limited to one type (docs, feature, etc.) and keep it as small as possible. You can open multiple prs instead of opening a huge one. --> <!-- If this pull request closes an issue, please mention the issue number below --> <!-- Issue # here --> Closes #4964 <!-- Add an introduction into what this PR tries to solve in a couple of sentences --> ### What's changed <!-- Describe point by point the different things you have changed in this PR --> This PR fixes a test case for the `verifyMagicLinkTokens` function. The test case was related to a timestamp issue, which is difficult to reproduce unless the test runs on a very fast machine. #### Explanatiton Most of the time when we run the tests, `expiresOn` becomes slightly outdated by the time and the test function passes. Whenever you use a fast machine, `expiresOn` may hold the current time, which can trigger an error in subsequent functions. <!-- You can also choose to add a list of changes and if they have been completed or not by using the markdown to-do list syntax - [ ] Not Completed - [x] Completed --> ### Notes to reviewers <!-- Any information you feel the reviewer should know about when reviewing your PR --> Nil ### How to Test Just run the followed cmds ```cmd cd packages/hoppscotch-backend pnpm run test ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:29:44 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5006
No description provided.