feat(purchase-order): cover purchase_order_number payloads - #95
Open
tiagolupepic wants to merge 5 commits into
Open
feat(purchase-order): cover purchase_order_number payloads#95tiagolupepic wants to merge 5 commits into
tiagolupepic wants to merge 5 commits into
Conversation
tiagolupepic
commented
Jul 31, 2026
ancorcruz
reviewed
Jul 31, 2026
ancorcruz
left a comment
Contributor
There was a problem hiding this comment.
Direction looks right, and the mock_fetch removal is worth merging on its own — deno task test is currently broken on main.
Three things before merge, details inline:
- The
satisfies X & { purchase_order_number: string }intersections aren't needed — the current spec already typespurchase_order_number?: string | nullon every payload touched here — and they make the fixtures unable to fail, which defeats the point of adding them. tests/wallet.test.ts:61-62adds two new type errors (credits arestringinWalletRecurringTransactionRule). Measured against a freshly generated client: 77 errors onmain→ 79 here.- Worth being explicit that none of this runs in CI:
.github/workflows/ci.ymlrunsdeno task build+deno task typecheck, andtypecheckonly coversmod.ts,webhook_types.tsandtests/webhook_types.test.ts.deno task testisn't wired in, and the suite fails type-check with 77 pre-existing errors (stale namesWalletInput→WalletCreateInput,Wallets→WalletsPaginated,Subscriptions→SubscriptionsPaginated, plus number-vs-string amounts). So as merged these assertions are documentation, not a safety net. This PR clears the biggest blocker — a follow-up that fixes the fixture drift and addsdeno task testto CI is where the value actually lands.
Two coverage gaps vs the description, if you want them in scope:
WalletUpdateInput.wallet.recurring_transaction_rules[].purchase_order_numberexists in the spec but isn't covered (only the top-level field is inwalletUpdateInput).- Nothing exercises
purchase_order_number: null, which the spec allows.
- Drop `satisfies X & { ... }` intersections that made purchase_order_number
checks unable to fail if the field disappeared
- Fix stale generated type names (WalletInput, Wallets, WalletTransactionInput)
- Fix numeric fixtures that should be strings (paid_credits, granted_credits,
amount, credit_amount) and fill in required recurring-rule response fields
- Build walletsResponse from the response fixture instead of the input fixture
- Restore expectedBody support in lagoTest with an undefined check instead of
truthiness, and assert after the client call returns so failures surface as
normal assertion errors instead of being swallowed by the error path
- Dedupe the hand-rolled mock fetch in rate_limit.test.ts to reuse
tests/utils.ts's createMockFetch
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The error path awaited assertRequest but the 200 path didn't, so a body mismatch there would surface as an unhandled promise rejection instead of a normal assertion failure. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.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.
Add purchase order number support