Add validation tests and coverage improvements for Send and feature flows#1222
Open
Bluuefanatic wants to merge 10 commits into
Open
Add validation tests and coverage improvements for Send and feature flows#1222Bluuefanatic wants to merge 10 commits into
Bluuefanatic wants to merge 10 commits into
Conversation
… and collaborative validation flows
…developer mode override
… in SendForm component
…d validation tests
3 tasks
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.
Summary
This PR improves test coverage for critical wallet flows in Jam, with a focus on Send validation logic and feature flag evaluation.
It also introduces a minimal refactor to make validation logic testable without altering existing behavior.
Key Changes
1. Validation Refactor (Minimal, Non-breaking)
Extracted validation schema logic from:
src/components/send/SendForm.tsxInto a dedicated module:
src/components/send/sendValidationSchema.tsBehavior remains unchanged; logic is now reusable and testable in isolation.
2. Added Validation Tests
Send Form Validation
SendForm.validation.test.tsCovers:
(valid, malformed, null/undefined, wrong network)
(positive, zero, negative, NaN, large values)
(boundaries and malformed inputs)
Collaborative Send Validation
collaborativeSend.validation.test.tsCovers:
(NaN, null, malformed values)
amount_sats = 0)3. Feature Flag Tests (Adapted to
v2)The file
src/constants/features.tsreferenced in the task is not present in thev2branch.Feature logic is currently implemented via:
src/hooks/useFeatures.tssrc/constants/debugFeatures.tsTests were added to validate:
4. Coverage Improvements
Notes
helpers.ts,features.ts) are not present inv2Why This Matters
Jam handles real Bitcoin transactions, where validation errors can lead to:
Improving test coverage for these flows reduces regression risk and increases overall reliability.