test(frontend): cover Onramper signing errors#13153
Draft
cursor[bot] wants to merge 2 commits into
Draft
Conversation
Co-authored-by: Antonio Ventilii <AntonioVentilii@users.noreply.github.com>
Co-authored-by: Antonio Ventilii <AntonioVentilii@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Recent OnRamper signing changes made the frontend depend on distinct canister error classes for unavailable-signing UX and telemetry. A regression in this mapper or canister boundary could collapse secret misconfiguration and rate limiting into generic errors, hiding the actual business failure mode.
Risky behavior now covered:
SecretNotConfiguredmaps toOnramperSecretNotConfiguredErrorwith the expected user-flow message.RateLimitedmaps toOnramperRateLimitedErrorwith the backend rate-limit window details.BackendCanister.signOnramperWidgetUrlserializes wallet, network-wallet, and wallet-address-tag params to the Candid request shape and propagates the signed response.Changes
src/frontend/src/tests/lib/canisters/backend.errors.spec.ts.BackendCanister.signOnramperWidgetUrlboundary coverage insrc/frontend/src/tests/lib/canisters/backend.canister.spec.ts.Test files added/updated:
src/frontend/src/tests/lib/canisters/backend.errors.spec.tssrc/frontend/src/tests/lib/canisters/backend.canister.spec.tsWhy these tests materially reduce regression risk:
Tests
npm run test -- src/frontend/src/tests/lib/canisters/backend.errors.spec.ts src/frontend/src/tests/lib/canisters/backend.canister.spec.tsnpx prettier --check src/frontend/src/tests/lib/canisters/backend.errors.spec.ts src/frontend/src/tests/lib/canisters/backend.canister.spec.tsnpx eslint --max-warnings 0 src/frontend/src/tests/lib/canisters/backend.errors.spec.ts src/frontend/src/tests/lib/canisters/backend.canister.spec.tsnpm run check:testsNote: the first validation attempt failed before tests ran because dependencies were not installed and the runner shim resolved
nodeto v22. After installing Node 24.17.0 withnvm, prepending its bin directory toPATH, and runningnpm ci, the targeted tests and checks above passed.