Follow-up from #8 review. CodeRabbit's last nitpick on PR #8 flagged that tests/client.test.ts has strong happy-path and generic-failure coverage for pay(), but three payment-flow edges are still untested:
- Timeout —
mockFetch rejects with new Error('ETIMEDOUT') on both attempts; assert client.pay returns success: false and error contains ETIMEDOUT.
- 402 retry —
mockFetch first returns 402 { error: 'Payment required', code: 'PAYMENT_REQUIRED' }, then succeeds on retry; assert success: true and mockFetch was called twice.
- Insufficient balance —
verify returns valid with settlementToken, but settle returns 402 { error: 'Insufficient balance', code: 'INSUFFICIENT_FUNDS' }; assert success: false and errorCode === 'INSUFFICIENT_FUNDS'.
All three should follow the same mockFetch / client.pay shape as the surrounding tests, with body inspection via mockFetch.mock.calls.
Good first issue for a TS contributor. Not a blocker for #8 merge — kept that PR receipt-scoped.
Per coding guidelines tests/**: covers "Coverage of payment flow edge cases (402 retry, balance insufficient, timeout)".
Follow-up from #8 review. CodeRabbit's last nitpick on PR #8 flagged that
tests/client.test.tshas strong happy-path and generic-failure coverage forpay(), but three payment-flow edges are still untested:mockFetchrejects withnew Error('ETIMEDOUT')on both attempts; assertclient.payreturnssuccess: falseand error containsETIMEDOUT.mockFetchfirst returns402 { error: 'Payment required', code: 'PAYMENT_REQUIRED' }, then succeeds on retry; assertsuccess: trueandmockFetchwas called twice.verifyreturns valid withsettlementToken, butsettlereturns402 { error: 'Insufficient balance', code: 'INSUFFICIENT_FUNDS' }; assertsuccess: falseanderrorCode === 'INSUFFICIENT_FUNDS'.All three should follow the same
mockFetch/client.payshape as the surrounding tests, with body inspection viamockFetch.mock.calls.Good first issue for a TS contributor. Not a blocker for #8 merge — kept that PR receipt-scoped.
Per coding guidelines
tests/**: covers "Coverage of payment flow edge cases (402 retry, balance insufficient, timeout)".