Skip to content

Improve SampleGasPricesService tests#8058

Open
mcmire wants to merge 2 commits intomainfrom
tweak-example-service-tests
Open

Improve SampleGasPricesService tests#8058
mcmire wants to merge 2 commits intomainfrom
tweak-example-service-tests

Conversation

@mcmire
Copy link
Contributor

@mcmire mcmire commented Feb 26, 2026

Explanation

  • Improve test names
  • Don't assume default degraded threshold, but use constant
  • Don't wait when advancing timers so we don't need an extra .catch(console.error)
  • Ensure that maxRetries and maxConsecutiveFailures options are tested as well

References

No tickets, but I was reviewing someone's PR and noticed some anti-patterns and deficiencies in the current tests.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Test-only changes: renames/clarifies assertions around degraded/retry/circuit-break behavior and makes timer advancement deterministic, with no production code impact.

Overview
Improves SampleGasPricesService test coverage and clarity around service-policy behavior (degraded detection, retries, circuit breaker open/close).

Tests now use DEFAULT_DEGRADED_THRESHOLD instead of a hardcoded value, advance Jest timers synchronously (removing async .catch workarounds), and add explicit coverage that policyOptions like degradedThreshold, maxRetries, and maxConsecutiveFailures are configurable.

Written by Cursor Bugbot for commit 75ee10e. This will update automatically on new commits. Configure here.

- Improve test names
- Don't assume default degraded threshold, but use constant
- Don't wait when advancing timers so we don't need an extra
  `.catch(console.error)`
- Ensure that `maxRetries` and `maxConsecutiveFailures` options are
  tested as well
@mcmire mcmire marked this pull request as ready for review February 26, 2026 18:33
@mcmire mcmire requested a review from a team as a code owner February 26, 2026 18:33
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.

1 participant