Skip to content

Commit 2bde1e4

Browse files
docs: add test-first contribution guide (#507)
Co-authored-by: silentgeckoaudit3801 <silentgeckoaudit3801@users.noreply.github.com>
1 parent 07600f7 commit 2bde1e4

2 files changed

Lines changed: 90 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ React Native Expo wallet for Stellar Testnet. The app aims to feel polished and
1414
- [Architecture Readiness Review](./docs/architecture-readiness-review.md) - Feature boundaries, duplicated state, SDK integration blockers, security-sensitive areas, and test gaps
1515
- [Evaluation Readiness Checklist](./docs/evaluation-readiness-checklist.md) - GrantFox contributor checklist for mobile issues, including tests, CI, screenshots, acceptance criteria, and the reminder that merge does not guarantee payment approval
1616
- [Storage Guide](./docs/storage.md) - SecureStore vs AsyncStorage
17+
- [Test-First Contribution Guide](./docs/test-first-contribution-guide.md) - Required test planning, happy-path and negative-path coverage, no-test justification rules, and local verification commands for mobile PRs
1718
- [Contacts Guide](./docs/contacts.md) - Contact storage, backup limitations, and future export/import ideas
1819
- [Polyfills Guide](./docs/polyfills.md) - React Native polyfills and import order for Stellar SDK
1920
- [Vault UI Guidance](./docs/vault-ui-guidance.md) - How to present the Soroban Savings Vault, Testnet risks, and contract limitations
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Test-First Contribution Guide
2+
3+
PocketPay Mobile changes should start with a test plan. Use this guide before editing wallet creation, wallet import, balance, send, receive, QR, address book, or vault flows.
4+
5+
## Required Test Plan
6+
7+
Every PR should describe the behavior being changed, the user flow affected, the expected happy path, and at least one negative path. Add this plan to the PR before requesting review so reviewers can compare the implementation, tests, and acceptance criteria.
8+
9+
## Screen Expectations
10+
11+
### Wallet Creation
12+
13+
- Cover successful wallet creation with the expected account state, stored secret handling, and first-screen navigation.
14+
- Cover cancellation, invalid setup state, duplicate setup attempts, and storage failures.
15+
- Verify secrets are not logged, copied, or rendered outside the intended confirmation UI.
16+
17+
### Wallet Import
18+
19+
- Cover valid secret import, imported account persistence, and post-import navigation.
20+
- Cover invalid secret formats, wrong network assumptions, empty input, and storage failures.
21+
- Verify error copy helps the user recover without exposing the submitted secret.
22+
23+
### Balance
24+
25+
- Cover loaded balances, empty accounts, refresh behavior, and stale or loading states.
26+
- Cover API, SDK, or network failures with a visible retry path.
27+
- Verify rounding, asset labels, and unavailable balances do not imply spendable funds.
28+
29+
### Send
30+
31+
- Cover valid recipient, amount entry, fee or network assumptions, confirmation, and submitted transaction state.
32+
- Cover invalid address, insufficient balance, zero or negative amount, user cancellation, signing failure, and submission failure.
33+
- Verify the app never signs or submits before the user reaches the final confirmation step.
34+
35+
### Receive And QR
36+
37+
- Cover displayed receive address, copied address feedback, QR rendering, and scan-to-pay review behavior.
38+
- Cover missing address, camera permission denial, malformed QR payload, unsupported network, and user cancellation.
39+
- Verify scanning a QR code leads to review, not automatic payment.
40+
41+
### Address Book
42+
43+
- Cover adding, editing, deleting, searching, and selecting saved contacts.
44+
- Cover duplicate names, invalid addresses, empty states, and storage failures.
45+
- Verify destructive actions require clear user intent.
46+
47+
### Vault
48+
49+
- Cover vault overview, deposit preparation, withdraw preparation, pending states, and disabled states when assumptions are missing.
50+
- Cover SDK or contract failure, missing wallet, insufficient balance, unsupported network, and unavailable contract data.
51+
- Verify the UI distinguishes simulated, testnet, pending, and confirmed vault states.
52+
53+
## Happy-Path And Negative-Path Rules
54+
55+
A meaningful test set includes both success and failure behavior. If a PR changes a mobile flow, include at least one happy-path test and one negative-path test for the affected screen, hook, store, or service. For documentation-only changes, explain why runtime tests are not applicable and list the static review performed.
56+
57+
## Local Verification Commands
58+
59+
Run the commands that match the change scope:
60+
61+
```bash
62+
npm test -- --runInBand
63+
npm run typecheck
64+
npm run lint
65+
npm run api:check
66+
```
67+
68+
Use `npm run api:check` when the change touches PocketPay SDK assumptions, mocks, vault integration, or service boundaries. Use `npm run lint` and `npm run typecheck` for source, test, and documentation examples that include TypeScript snippets.
69+
70+
## No-Test Justification
71+
72+
A PR may omit runtime tests only when the change is documentation-only, copy-only, or otherwise impossible to exercise in the current test harness. The PR must then include:
73+
74+
- The reason no runtime test was added.
75+
- The files reviewed manually.
76+
- Any local commands that still ran.
77+
- The risk that remains untested.
78+
- Follow-up coverage needed if the implementation later changes.
79+
80+
## Evidence To Include In The PR
81+
82+
- The acceptance criteria covered by the change.
83+
- Test files added or updated.
84+
- Local commands run and their results.
85+
- Manual verification notes for affected screens.
86+
- Screenshots or recordings for visible UI changes when available.
87+
- Known limitations, skipped checks, or follow-up work.
88+
89+
A merged PR can still fail evaluation if the test evidence is incomplete, CI is failing, or the implementation only covers part of the requested behavior.

0 commit comments

Comments
 (0)