[PR #3070] [MERGED] fix: timing dependency on test case #4211

Closed
opened 2026-03-17 01:46:11 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/3070
Author: @mirarifhasan
Created: 5/22/2023
Status: Merged
Merged: 5/23/2023
Merged by: @AndrewBastin

Base: release/2023.4.4Head: fix/user-history-test-case


📝 Commits (1)

  • 46ac7e3 fix: timing dependency on test case

📊 Changes

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

View changed files

📝 packages/hoppscotch-backend/src/user-history/user-history.service.spec.ts (+5 -3)

📄 Description

Closes HBE-194

Description

In this PR, we fix a unit test issue for the backend by which the build was being failed.

packages/hoppscotch-backend do-test:     - Expected Right  - 1
packages/hoppscotch-backend do-test:     + Received Right  + 1
packages/hoppscotch-backend do-test:       Object {
packages/hoppscotch-backend do-test:     -   "executedOn": 2023-04-23T10:19:35.258Z,
packages/hoppscotch-backend do-test:     +   "executedOn": 2023-04-23T10:19:35.257Z,
packages/hoppscotch-backend do-test:         "id": "1",
packages/hoppscotch-backend do-test:         "isStarred": false,
packages/hoppscotch-backend do-test:         "reqType": "REST",
packages/hoppscotch-backend do-test:         "request": "[{}]",
packages/hoppscotch-backend do-test:         "responseMetadata": "[{}]",
packages/hoppscotch-backend do-test:         "userUid": "abc",
packages/hoppscotch-backend do-test:       }

Here if you see, you will notice that the executedOn value is mismatched by a millisecond. This occurred because of we had written new Date() twice instead of using the same reference.

https://github.com/hoppscotch/hoppscotch/actions/runs/4777765956/jobs/8493727095

How to Reproduce Issue

Just run the backend test cases, sometime you will get this issue.

pnpm run test

Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

Additional Information

Nil


🔄 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/3070 **Author:** [@mirarifhasan](https://github.com/mirarifhasan) **Created:** 5/22/2023 **Status:** ✅ Merged **Merged:** 5/23/2023 **Merged by:** [@AndrewBastin](https://github.com/AndrewBastin) **Base:** `release/2023.4.4` ← **Head:** `fix/user-history-test-case` --- ### 📝 Commits (1) - [`46ac7e3`](https://github.com/hoppscotch/hoppscotch/commit/46ac7e3a16809788a90d225ed968e6276b888f13) fix: timing dependency on test case ### 📊 Changes **1 file changed** (+5 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-backend/src/user-history/user-history.service.spec.ts` (+5 -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 HBE-194 ### Description <!-- Add a brief description of the pull request --> In this PR, we fix a unit test issue for the backend by which the build was being failed. ``` packages/hoppscotch-backend do-test: - Expected Right - 1 packages/hoppscotch-backend do-test: + Received Right + 1 packages/hoppscotch-backend do-test: Object { packages/hoppscotch-backend do-test: - "executedOn": 2023-04-23T10:19:35.258Z, packages/hoppscotch-backend do-test: + "executedOn": 2023-04-23T10:19:35.257Z, packages/hoppscotch-backend do-test: "id": "1", packages/hoppscotch-backend do-test: "isStarred": false, packages/hoppscotch-backend do-test: "reqType": "REST", packages/hoppscotch-backend do-test: "request": "[{}]", packages/hoppscotch-backend do-test: "responseMetadata": "[{}]", packages/hoppscotch-backend do-test: "userUid": "abc", packages/hoppscotch-backend do-test: } ``` Here if you see, you will notice that the `executedOn` value is mismatched by a millisecond. This occurred because of we had written `new Date()` twice instead of using the same reference. [https://github.com/hoppscotch/hoppscotch/actions/runs/4777765956/jobs/8493727095](https://github.com/hoppscotch/hoppscotch/actions/runs/4777765956/jobs/8493727095) <!-- 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 --> ### How to Reproduce Issue Just run the backend test cases, sometime you will get this issue. ``` pnpm run test ``` ### Checks <!-- Make sure your pull request passes the CI checks and do check the following fields as needed - --> - [x] My pull request adheres to the code style of this project - [ ] My code requires changes to the documentation - [ ] I have updated the documentation as required - [x] All the tests have passed ### Additional Information <!-- Any additional information like breaking changes, dependencies added, screenshots, comparisons between new and old behaviour, etc. --> Nil --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 01:46:11 +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#4211
No description provided.