Add unit tests for graceful-shutdown service + Add unit tests for request-router service - #1362
Merged
Merged
Conversation
…uest-router service
|
@ykargeee-bit Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Thank you for contributing to the project |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1275
…
Summary
Adds focused unit test suites for two previously untested common services, bringing their public APIs under verified coverage.
What changed
src/common/request-router.service.spec.tsselectTarget— single/multiple targets, empty array, weight boundaries, fractional weights, and floating-point edge casessrc/common/services/graceful-shutdown.service.spec.tsregisterShutdownPhase,shutdown,isShutdownInProgress,getShutdownStatus, andonModuleDestroy— including phase ordering, error/timeoute resilience, force-exit timer behavior, and dedup guardpackage.json/package-lock.jsonts-jestas a dev dependency (required by the existing Jest config but was missing fromnode_modules)Motivation
Both services had no accompanying
*.spec.tsfiles, making their behaviour unverified and easy to regress. These tests lock down the public API surface and document edge cases (e.g. non-numericSHUTDOWN_TIMEOUT_MSresults inNaN).Test results
Closes #1276
Notes
SHUTDOWN_TIMEOUT_MSnon-numeric env var case surfaces a latent bug (parseIntreturnsNaNwith no fallback). The test documents this; a follow-up can add a guard.FORCE_EXIT_ON_TIMEOUT=falseis set in the test environment to preventprocess.exit(1)from killing the test runner.Closes #1278