Skip to content

Feat/compt 83 testing suite#25

Merged
saadmoumou merged 2 commits intodevelopfrom
feat/COMPT-83-testing-suite
Apr 2, 2026
Merged

Feat/compt 83 testing suite#25
saadmoumou merged 2 commits intodevelopfrom
feat/COMPT-83-testing-suite

Conversation

@saadmoumou
Copy link
Copy Markdown
Contributor

Summary

  • What does this PR change?

Why

  • Why is this change needed?

Checklist

  • Added/updated tests (if behavior changed)
  • npm run lint passes
  • npm run typecheck passes
  • npm test passes
  • npm run build passes
  • Added a changeset (npx changeset) if this affects consumers

Notes

  • Anything reviewers should pay attention to?

Copilot AI review requested due to automatic review settings April 2, 2026 15:01
@saadmoumou saadmoumou requested a review from a team as a code owner April 2, 2026 15:01
@saadmoumou saadmoumou merged commit 3162d4d into develop Apr 2, 2026
4 checks passed
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 2, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds/updates Jest tests around the health-kit module and health endpoints, aligning test expectations with the current HealthCheckResult shape and raising global coverage requirements.

Changes:

  • Added a new HealthKitModule test suite covering register() / registerAsync() and indicator auto-registration.
  • Updated existing controller/service tests to use results (instead of indicators) and simplify typing in a finder.
  • Increased Jest global coverage thresholds from 80% to 85%.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/services/health.service.spec.ts Minor test typing simplification when locating a failed indicator result.
src/controllers/health.controller.spec.ts Updates mocked service return shape to { status, results }.
src/health-kit.module.spec.ts New module-level tests for dynamic module wiring and DI-based indicator routing.
jest.config.ts Raises global coverage thresholds to 85%.

Comment on lines +17 to +18
// ÔöÇÔöÇ Fixtures ÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇ

Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The section divider comments contain garbled/non-UTF8 characters (looks like an encoding issue), which makes the test hard to read/maintain. Replace these with plain ASCII/UTF-8 text (e.g., // -- Fixtures --).

Copilot uses AI. Check for mistakes.
Comment on lines +101 to +105
const liveness = module.get<HealthIndicatorResult[]>(HEALTH_LIVENESS_INDICATORS);
expect(liveness).toHaveLength(1);

const readiness = module.get<HealthIndicatorResult[]>(HEALTH_READINESS_INDICATORS);
expect(readiness).toHaveLength(0);
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HEALTH_LIVENESS_INDICATORS is provided as an array of indicator instances (IHealthIndicator[] / BaseHealthIndicator[]), but the test retrieves it as HealthIndicatorResult[]. This defeats type-safety and can mask real regressions. Update the module.get<...> generic to match the actual provider type.

Copilot uses AI. Check for mistakes.
Comment on lines +114 to +118
const readiness = module.get<HealthIndicatorResult[]>(HEALTH_READINESS_INDICATORS);
expect(readiness).toHaveLength(1);

const liveness = module.get<HealthIndicatorResult[]>(HEALTH_LIVENESS_INDICATORS);
expect(liveness).toHaveLength(0);
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same type issue here: HEALTH_READINESS_INDICATORS is an indicator-instance array, but it's retrieved as HealthIndicatorResult[]. Use the correct injected type (e.g., IHealthIndicator[]) so TypeScript enforces the expected shape.

Copilot uses AI. Check for mistakes.
Comment on lines +129 to +131
const readiness = module.get<HealthIndicatorResult[]>(HEALTH_READINESS_INDICATORS);
expect(readiness).toHaveLength(2);
});
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same type mismatch: module.get<HealthIndicatorResult[]>(HEALTH_READINESS_INDICATORS) should use the indicator instance type returned by the provider (not the check result type).

Copilot uses AI. Check for mistakes.
Comment on lines +152 to +154
const liveness = module.get<HealthIndicatorResult[]>(HEALTH_LIVENESS_INDICATORS);
const readiness = module.get<HealthIndicatorResult[]>(HEALTH_READINESS_INDICATORS);

Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same provider typing issue in this test: both HEALTH_LIVENESS_INDICATORS / HEALTH_READINESS_INDICATORS tokens resolve to indicator instances, but they’re retrieved as HealthIndicatorResult[]. Use IHealthIndicator[] (or BaseHealthIndicator[]) generics for correct typing.

Copilot uses AI. Check for mistakes.
Zaiidmo added a commit that referenced this pull request Apr 7, 2026
* initiated dev environment

* ops (ci): standardize publish validation and dependabot across all packages

- Replace git tag --list strategy with package.json-driven tag validation
  in all 16 publish workflows; use git rev-parse to verify the exact tag
  exists rather than guessing the latest repo-wide tag
- Update error guidance to reflect feat/** → develop → master flow
- Standardize dependabot to npm-only, grouped, monthly cadence across
  all 16 packages; remove github-actions ecosystem updates
- Add missing dependabot.yml to AuthKit-UI, ChartKit-UI, HealthKit,
  HooksKit, paymentkit, StorageKit

* security: added CODEOWNER file for branches security \\

* ops: updated relese check workflow#

* I health indicator interface and built in indicators (#1)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Health module and health endpoints (#2)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

* chore(config): set module to CommonJS and moduleResolution to Node for dist output

* chore(package): rename to @ciscode/health-kit

* chore(deps): update package-lock

* feat(indicators): add MongoHealthIndicator with ping command and timeout

* test(indicators): add MongoHealthIndicator unit tests (success/error/timeout)

* feat(services): add HealthService with Promise.allSettled orchestration

* test(services): add HealthService unit tests (liveness/readiness/concurrency)

* feat(controllers): add HealthController factory (GET live/ready, platform-agnostic)

* test(controllers): add HealthController unit tests (200 ok / 503 ServiceUnavailableException)

* feat(module): add HealthKitModule.register() dynamic module

* feat(exports): update public API exports for health-kit

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Ihealth indicator interface and built in indicators (#3)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Health module and health endpoints (#5)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

* chore(config): set module to CommonJS and moduleResolution to Node for dist output

* chore(package): rename to @ciscode/health-kit

* chore(deps): update package-lock

* feat(indicators): add MongoHealthIndicator with ping command and timeout

* test(indicators): add MongoHealthIndicator unit tests (success/error/timeout)

* feat(services): add HealthService with Promise.allSettled orchestration

* test(services): add HealthService unit tests (liveness/readiness/concurrency)

* feat(controllers): add HealthController factory (GET live/ready, platform-agnostic)

* test(controllers): add HealthController unit tests (200 ok / 503 ServiceUnavailableException)

* feat(module): add HealthKitModule.register() dynamic module

* feat(exports): update public API exports for health-kit

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Custom indicator api and health service (#7)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

* chore(config): set module to CommonJS and moduleResolution to Node for dist output

* chore(package): rename to @ciscode/health-kit

* chore(deps): update package-lock

* feat(indicators): add MongoHealthIndicator with ping command and timeout

* test(indicators): add MongoHealthIndicator unit tests (success/error/timeout)

* feat(services): add HealthService with Promise.allSettled orchestration

* test(services): add HealthService unit tests (liveness/readiness/concurrency)

* feat(controllers): add HealthController factory (GET live/ready, platform-agnostic)

* test(controllers): add HealthController unit tests (200 ok / 503 ServiceUnavailableException)

* feat(module): add HealthKitModule.register() dynamic module

* feat(exports): update public API exports for health-kit

* feat(indicators): add createIndicator inline factory with timeout support

* test(indicators): add createIndicator unit tests (true/false/void/throw/timeout)

* feat(indicators): add BaseHealthIndicator abstract class with result() helper

* test(indicators): add BaseHealthIndicator unit tests

* feat(decorators): add @healthindicator decorator for auto-registration by scope

* test(decorators): add @healthindicator decorator unit tests

* feat(module): extend HealthKitModule.register() with indicators[] option for DI-based auto-registration

* feat(exports): export createIndicator, BaseHealthIndicator, @healthindicator, HealthIndicatorScope

* chore(package): update description to mention MongoDB

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 80 ihealth indicator interface and built in indicators (#8)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 81 health module and health endpoints (#9)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

* chore(config): set module to CommonJS and moduleResolution to Node for dist output

* chore(package): rename to @ciscode/health-kit

* chore(deps): update package-lock

* feat(indicators): add MongoHealthIndicator with ping command and timeout

* test(indicators): add MongoHealthIndicator unit tests (success/error/timeout)

* feat(services): add HealthService with Promise.allSettled orchestration

* test(services): add HealthService unit tests (liveness/readiness/concurrency)

* feat(controllers): add HealthController factory (GET live/ready, platform-agnostic)

* test(controllers): add HealthController unit tests (200 ok / 503 ServiceUnavailableException)

* feat(module): add HealthKitModule.register() dynamic module

* feat(exports): update public API exports for health-kit

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 82 custom indicator api and health service (#11)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

* chore(config): set module to CommonJS and moduleResolution to Node for dist output

* chore(package): rename to @ciscode/health-kit

* chore(deps): update package-lock

* feat(indicators): add MongoHealthIndicator with ping command and timeout

* test(indicators): add MongoHealthIndicator unit tests (success/error/timeout)

* feat(services): add HealthService with Promise.allSettled orchestration

* test(services): add HealthService unit tests (liveness/readiness/concurrency)

* feat(controllers): add HealthController factory (GET live/ready, platform-agnostic)

* test(controllers): add HealthController unit tests (200 ok / 503 ServiceUnavailableException)

* feat(module): add HealthKitModule.register() dynamic module

* feat(exports): update public API exports for health-kit

* feat(indicators): add createIndicator inline factory with timeout support

* test(indicators): add createIndicator unit tests (true/false/void/throw/timeout)

* feat(indicators): add BaseHealthIndicator abstract class with result() helper

* test(indicators): add BaseHealthIndicator unit tests

* feat(decorators): add @healthindicator decorator for auto-registration by scope

* test(decorators): add @healthindicator decorator unit tests

* feat(module): extend HealthKitModule.register() with indicators[] option for DI-based auto-registration

* feat(exports): export createIndicator, BaseHealthIndicator, @healthindicator, HealthIndicatorScope

* chore(package): update description to mention MongoDB

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 80 ihealth indicator interface and built in indicators (#12)

* chore(config): add @interfaces/* and @indicators/* path aliases

* chore(config): rename eslint.config.js to .mjs to fix ESM loading

* chore(git): fix husky pre-commit hook for v10 compatibility

* feat(interfaces): add IHealthIndicator, HealthStatus, HealthIndicatorResult

* feat(indicators): add PostgresHealthIndicator (SELECT 1 + timeout)

* test(indicators): add PostgresHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add RedisHealthIndicator (PING + timeout)

* test(indicators): add RedisHealthIndicator unit tests (success/error/timeout)

* feat(indicators): add HttpHealthIndicator (GET + 2xx check + timeout)

* test(indicators): add HttpHealthIndicator unit tests (2xx/non-2xx/network/timeout)

* chore(deps): update package-lock after npm install

* fix(interfaces): add optional details field to HealthIndicatorResult

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 81 health module and health endpoints (#18)

* fix(services): rename indicators to results in HealthCheckResult response

* fix(tests): update health.service.spec to use results instead of indicators

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 82 custom indicator api and health service (#23)

* fix(services): rename indicators to results in HealthCheckResult response

* fix(tests): update health.service.spec to use results instead of indicators

* chore(indicators): remove MongoHealthIndicator

* feat(module): make path optional with default 'health', add registerAsync

* feat(exports): remove MongoHealthIndicator, export HealthModuleAsyncOptions

* chore(package): add @nestjs/terminus peer dep, fix description

* chore(indicators): remove MongoHealthIndicator spec

* refactor(module): extract shared logic to eliminate code duplication

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 83 testing suite (#25)

* chore(indicators): remove MongoHealthIndicator spec

* test(module): add HealthKitModule spec - register, registerAsync, path default

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 84 readme changeset publish v0.1.0 (#26)

* fix(package): remove unused bundled dependencies (class-transformer, class-validator)

* chore(package): bump version to 0.1.0

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* docs(readme): rewrite README and add changeset for v0.1.0 (#28)

- Rewrite README.md for @ciscode/health-kit (remove template content)
- Add register/registerAsync usage examples
- Document built-in indicators: PostgresHealthIndicator, RedisHealthIndicator, HttpHealthIndicator
- Document custom indicator APIs: createIndicator, BaseHealthIndicator + @healthindicator
- Add 200/503 response body examples
- Add API reference tables
- Add .changeset/health-kit-v0-1-0.md: minor bump (0.0.0 -> 0.1.0)
- Fix .changeset/config.json repo field to CISCODE-MA/HealthKit
- Set package.json version to 0.0.0 (changeset will bump to 0.1.0)

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* Feat/compt 84 readme changeset publish v0.1.0 (#30)

* docs(readme): rewrite README and add changeset for v0.1.0

- Rewrite README.md for @ciscode/health-kit (remove template content)
- Add register/registerAsync usage examples
- Document built-in indicators: PostgresHealthIndicator, RedisHealthIndicator, HttpHealthIndicator
- Document custom indicator APIs: createIndicator, BaseHealthIndicator + @healthindicator
- Add 200/503 response body examples
- Add API reference tables
- Add .changeset/health-kit-v0-1-0.md: minor bump (0.0.0 -> 0.1.0)
- Fix .changeset/config.json repo field to CISCODE-MA/HealthKit
- Set package.json version to 0.0.0 (changeset will bump to 0.1.0)

* chore(package): set version to 0.1.0

---------

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* chore(release): version packages (#31)

Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>

* ci: update release check workflow

* ops: updated release check jobs

---------

Co-authored-by: Zaiidmo <zaiidmoumnii@gmail.com>
Co-authored-by: saad moumou <saad.moumou.coder@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants