[PR #3120] test: improved backend unit test cases #4239

Open
opened 2026-03-17 01:47:33 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/3120
Author: @mirarifhasan
Created: 6/7/2023
Status: 🔄 Open

Base: release/2023.4.8Head: test/backend-test-case


📝 Commits (10+)

  • 295304f test: admin service test case added
  • ddd0a67 fix: isLeft check in admin service
  • 6c928e7 test: team collection test coverage added
  • db42073 test: team request test coverage added
  • b83cc38 test: user collection test coverage added
  • 76d52a3 test: user request test coverage added
  • 39a4fd8 test: user-history millisecond issue
  • d2ca631 Merge branch 'main' into test/backend-test-case
  • b867ba9 Merge branch 'release/2023.4.8' into test/backend-test-case
  • a2a675d chore: fixed issues with test cases in team-environment module

📊 Changes

8 files changed (+1458 additions, -26 deletions)

View changed files

📝 packages/hoppscotch-backend/src/admin/admin.service.spec.ts (+587 -0)
📝 packages/hoppscotch-backend/src/admin/admin.service.ts (+1 -0)
📝 packages/hoppscotch-backend/src/team-collection/team-collection.service.spec.ts (+184 -6)
📝 packages/hoppscotch-backend/src/team-environments/team-environments.service.spec.ts (+2 -2)
📝 packages/hoppscotch-backend/src/team-request/team-request.service.spec.ts (+90 -9)
📝 packages/hoppscotch-backend/src/user-collection/user-collection.service.spec.ts (+480 -1)
📝 packages/hoppscotch-backend/src/user-history/user-history.service.spec.ts (+16 -8)
📝 packages/hoppscotch-backend/src/user-request/user-request.service.spec.ts (+98 -0)

📄 Description

Closes HBE-203

Description

In this PR, we add a few test cases to improve our test coverage throughout hoppscotch-backend. Unit test cases added for the following modules:

  1. Admin Module
  2. Team Collection Module
  3. Team Request Module
  4. User Collection Module
  5. User Request Module

How to run test cases

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

cd packages/hoppscotch-backend
npm 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/3120 **Author:** [@mirarifhasan](https://github.com/mirarifhasan) **Created:** 6/7/2023 **Status:** 🔄 Open **Base:** `release/2023.4.8` ← **Head:** `test/backend-test-case` --- ### 📝 Commits (10+) - [`295304f`](https://github.com/hoppscotch/hoppscotch/commit/295304feebcd7eb1074f3e7a728fe1a8b50ff986) test: admin service test case added - [`ddd0a67`](https://github.com/hoppscotch/hoppscotch/commit/ddd0a67da3902f0d4cef6cd9a2fe8c09d6edc314) fix: isLeft check in admin service - [`6c928e7`](https://github.com/hoppscotch/hoppscotch/commit/6c928e72d4dbef13b1b69677454540d296a8c832) test: team collection test coverage added - [`db42073`](https://github.com/hoppscotch/hoppscotch/commit/db42073d428fef787545a3a796ac8f832e377641) test: team request test coverage added - [`b83cc38`](https://github.com/hoppscotch/hoppscotch/commit/b83cc38a1c3e7bf6d95995e4c57e780dcf9318c4) test: user collection test coverage added - [`76d52a3`](https://github.com/hoppscotch/hoppscotch/commit/76d52a3b050482a57b77fd2d30aaf42f554eb20d) test: user request test coverage added - [`39a4fd8`](https://github.com/hoppscotch/hoppscotch/commit/39a4fd8ab25be18de0a5a9fd5e9afd951e1ef7bc) test: user-history millisecond issue - [`d2ca631`](https://github.com/hoppscotch/hoppscotch/commit/d2ca631492d5a89f07381343411da6b895f5b028) Merge branch 'main' into test/backend-test-case - [`b867ba9`](https://github.com/hoppscotch/hoppscotch/commit/b867ba91399edbbea8a80bd49a7df81f158bb4f6) Merge branch 'release/2023.4.8' into test/backend-test-case - [`a2a675d`](https://github.com/hoppscotch/hoppscotch/commit/a2a675dd86b028f5ce9032713c702463ccc6d91b) chore: fixed issues with test cases in team-environment module ### 📊 Changes **8 files changed** (+1458 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-backend/src/admin/admin.service.spec.ts` (+587 -0) 📝 `packages/hoppscotch-backend/src/admin/admin.service.ts` (+1 -0) 📝 `packages/hoppscotch-backend/src/team-collection/team-collection.service.spec.ts` (+184 -6) 📝 `packages/hoppscotch-backend/src/team-environments/team-environments.service.spec.ts` (+2 -2) 📝 `packages/hoppscotch-backend/src/team-request/team-request.service.spec.ts` (+90 -9) 📝 `packages/hoppscotch-backend/src/user-collection/user-collection.service.spec.ts` (+480 -1) 📝 `packages/hoppscotch-backend/src/user-history/user-history.service.spec.ts` (+16 -8) 📝 `packages/hoppscotch-backend/src/user-request/user-request.service.spec.ts` (+98 -0) </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-203 ### Description <!-- Add a brief description of the pull request --> In this PR, we add a few test cases to improve our test coverage throughout `hoppscotch-backend`. Unit test cases added for the following modules: 1. Admin Module 2. Team Collection Module 3. Team Request Module 4. User Collection Module 5. User Request Module <!-- 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 run test cases Just run the backend test cases, sometime you will get this issue. ``` cd packages/hoppscotch-backend npm 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>
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#4239
No description provided.