test(OUT-3955): integration tests for product.updated webhook - #72
Merged
Conversation
…ts, and item code constant Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Greptile SummaryThis PR adds integration coverage for the
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "test(OUT-3955): assert no-mapping branch..." | Re-trigger Greptile |
The product-not-mapped test previously asserted only 200 + no Xero call +
no rows, which the swallowed syncProductsAutomatically gate also satisfies.
Assert the handler's { items: [] } result in the response body so the test
proves it reached the no-mapping path.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
Author
|
@greptileai review again |
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.
What
Integration tests for the
product.updatedwebhook flow on the testcontainers harness (OUT-3955, parent OUT-3949). Test-only — no production code changed.Mirrors the existing
productCreated/suite: each test drives the real/api/webhookroute end to end and mocks only the Copilot and Xero API clients.Coverage (7 tests, all reachable branches)
happyPathupdateItemcalled with code +htmlToText'd description, SUCCESS log, mapping row untouched, 200productNotMappedsynced_itemsrow → service no-ops,updateItemnot called, 200syncProductsAutomaticallyDisabledAPIError(OK)swallowed → 200, no Xero callisSyncDisabledunsupportedRegioncountryCode='GB'→ ack & skip, 200xeroUpdateItemFailsupdateItemthrows → FAILED log +failed_syncs(type: 'product.updated'), mapping survives, 500missingXeroItemupdateItem, FAILED log +failed_syncs, 500Also adds shared scaffolding: a
productUpdatedfixture (HTML indescriptionto exercisehtmlToText), three mock defaults (getItemsMap,updateItem,getProductsMapById), and aTEST_XERO_ITEM.codeconstant.Intentionally out of scope
synced_items (portalId, tenantId, productId)makes the service loop length ≤ 1, and update has no "already applied" branch.getCopilotProductAndXeroItemnull-swallow) — shared production code; asserts only null names on an otherwise-SUCCESS log.Verification
pnpm typecheckandpnpm lintclean🤖 Generated with Claude Code