Skip to content

Add Missing Unit Test Coverage for Two Untested StellarService Methods and the Health-Monitor Threshold Logic #1718

Description

@Emmyt24

Description

backend/src/stellar-service-integration/stellar.service.ts's public getAccountWithSequence and executeTransaction methods have no unit tests in stellar.service.spec.ts (which covers every other public method), and monitoring/health-checks/health-monitor.ts's threshold logic in checkProjectionLag has no test coverage anywhere in the monitoring/ tree despite being straightforward to unit test with a fake query function.

Requirements and Context

  • Cover both the success and failure/edge-case paths for each of the three methods
  • Use a fake/mock dependency rather than a live network or database call

Suggested Execution

Branch: test/integration-cover-stellar-service-and-health-monitor

Implement Changes

  • Add unit tests for getAccountWithSequence and executeTransaction in stellar.service.spec.ts, covering success and failure paths
  • Add a new test file for health-monitor.ts's checkProjectionLag, using a fake queryFn to cover both above- and below-threshold cases
  • Confirm coverage for all three methods shows up in the existing coverage report

Test and Commit

Run npx vitest run src/stellar-service-integration/__tests__/stellar.service.spec.ts monitoring/health-checks/__tests__ — all three previously-untested code paths have passing unit tests covering success and failure cases.

Example Commit Message

test(integration): add missing unit test coverage for stellar service and health-monitor threshold logic

Closes #<issue>

Guidelines

  • Branch from main, open a PR back to main
  • All new code must have corresponding tests
  • Run npm run lint and npm run test before pushing
  • Follow existing naming conventions and file structure
  • PR description must reference this issue number (e.g., Closes #<issue>)
  • Keep commits atomic and use conventional commit format

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    integrationIntegration / external servicestestingTesting-focused contribution

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions