Claude
|
75136cb613
|
test: add comprehensive payment system tests (lnurl, platformFee, zapReceipts, zapRequests)
Add 4 new test files covering previously untested payment/zap logic:
- lnurl.test.mjs: bech32 encode/decode roundtrip, resolveLightningAddress
(email, lnurl, URL formats), fetchPayServiceData (success, HTTP errors,
invalid JSON, error status), validateInvoiceAmount (boundaries, invalid
inputs), requestInvoice (comment truncation, amount formats, error paths)
- platform-fee.test.mjs: parsePercentValue (numbers, bigints, strings with
%, fractions, edge cases), clampPercent (boundaries, NaN, non-finite),
getDefaultPlatformFeePercent, resolvePlatformFeePercent (override vs
fallback behavior)
- zap-receipt-validator.test.mjs: computeZapRequestHash determinism,
extractDescriptionHashFromBolt11, validateZapReceipt covering all failure
modes (missing request, invalid JSON, no relays, missing invoice,
hash mismatch, amount mismatch, wrong pubkey, invalid signature,
no receipt found) plus success path and override injection
- zap-requests.test.mjs: normalizeRelayList (dedup, filtering, empty),
resolveLnurlTag (bech32 vs email addresses), buildZapRequestPayload
(minimal and full params, timestamp handling), signZapRequest (signer
validation)
Also updates todo-test-coverage-gaps.md with a prioritized, detailed plan
covering all remaining untested areas (P0 through P3).
https://claude.ai/code/session_01QDsPRh4f31ZpDYqS1kETFV
|
2026-02-05 14:50:41 +00:00 |
|