Skip to content

test: add regression coverage for FxQuorumEvaluator validation - #1234

Merged
thlpkee20-wq merged 1 commit into
RevoraOrg:masterfrom
priscannanna85-lgtm:fix/issue-1096-add-regression-coverage-for-metric-quorum
Sep 29, 2026
Merged

thlpkee20-wq merged 1 commit into
RevoraOrg:masterfrom
priscannanna85-lgtm:fix/issue-1096-add-regression-coverage-for-metric-quorum

Conversation

@priscannanna85-lgtm

Copy link
Copy Markdown
Contributor

Overview

This PR adds focused regression coverage for the METRIC_QUORUM_EVALUATED failure handling in FxQuorumEvaluator. The evaluator throws explicit errors when k, tolerance, or reference are invalid; these branches previously had no dedicated tests, so silent behavior changes could slip through. This change exercises those branches, asserts the exact error contract, and adds neighboring success and boundary cases.

Related Issue

Changes

🧪 Quorum Evaluator Regression Tests

  • [MODIFY] src/services/fxQuorumEvaluator.ts

    • No behavioral change to the public contract; validation branches for k, tolerance, and reference are exercised as-is.
    • Ensures the three throw new Error(...) sites remain observable and deterministic for callers.
  • [ADD] src/services/fxQuorumEvaluator.test.ts

    • Failure paths:
      • k non-integer / k < 1 → FxQuorumEvaluator: k must be an integer >= 1.
      • tolerance non-finite / negative → FxQuorumEvaluator: tolerance must be a finite number >= 0.
      • reference not 'median' or 'mean' → FxQuorumEvaluator: reference must be 'median' or 'mean'.
    • Boundary inputs:
      • k = 1 (minimum valid) and tolerance = 0 (minimum valid).
      • reference = 'median' and reference = 'mean' both accepted.
    • Normal path:
      • Valid inputs return a quorum evaluation result without throwing, confirming the success branch alongside the failure branches.

Verification Results

npm test -- src/services/fxQuorumEvaluator.test.ts
✅ focused suite passed

npm test
✅ surrounding suite passed

npm run lint
✅ no new warnings or errors

npm run typecheck
✅ no type errors
Acceptance Criteria Status
Cover the named behavior with focused automated tests, including success and failure paths ✅ Failure branches for k, tolerance, reference plus a valid-input success case
Preserve the existing public contract unless the change includes an explicit compatibility plan ✅ No signature or error-message changes; tests assert current contract
Make error and boundary behavior observable and deterministic ✅ Exact error messages asserted; k = 1 and tolerance = 0 boundaries covered

Closes #1096

@drips-wave

drips-wave Bot commented Sep 29, 2026

Copy link
Copy Markdown

@priscannanna85-lgtm 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

@thlpkee20-wq
thlpkee20-wq merged commit 87f0b62 into RevoraOrg:master Sep 29, 2026
1 check 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

Development

Successfully merging this pull request may close these issues.

Add regression coverage for METRIC_QUORUM_EVALUATED failure handling

2 participants