Skip to content

Add unit tests for graceful-shutdown service + Add unit tests for request-router service - #1362

Merged
RUKAYAT-CODER merged 2 commits into
rinafcode:mainfrom
ykargeee-bit:feat/Request
Aug 28, 2026
Merged

Add unit tests for graceful-shutdown service + Add unit tests for request-router service#1362
RUKAYAT-CODER merged 2 commits into
rinafcode:mainfrom
ykargeee-bit:feat/Request

Conversation

@ykargeee-bit

Copy link
Copy Markdown
Contributor

Closes #1275

Summary

Adds focused unit test suites for two previously untested common services, bringing their public APIs under verified coverage.

What changed

File Description
src/common/request-router.service.spec.ts 8 tests covering selectTarget — single/multiple targets, empty array, weight boundaries, fractional weights, and floating-point edge cases
src/common/services/graceful-shutdown.service.spec.ts 19 tests covering registerShutdownPhase, shutdown, isShutdownInProgress, getShutdownStatus, and onModuleDestroy — including phase ordering, error/timeoute resilience, force-exit timer behavior, and dedup guard
package.json / package-lock.json Added ts-jest as a dev dependency (required by the existing Jest config but was missing from node_modules)
Closes #1277

Motivation

Both services had no accompanying *.spec.ts files, making their behaviour unverified and easy to regress. These tests lock down the public API surface and document edge cases (e.g. non-numeric SHUTDOWN_TIMEOUT_MS results in NaN).

Test results

Closes #1276

Notes

  • The SHUTDOWN_TIMEOUT_MS non-numeric env var case surfaces a latent bug (parseInt returns NaN with no fallback). The test documents this; a follow-up can add a guard.
  • FORCE_EXIT_ON_TIMEOUT=false is set in the test environment to prevent process.exit(1) from killing the test runner.

Closes #1278

@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project

@RUKAYAT-CODER
RUKAYAT-CODER merged commit 9bd11a4 into rinafcode:main Aug 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants