Colocate payment and webhook integration tests - #1899
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughPayment and webhook integration tests now import helpers from integration-specific paths. The payment setup helper declares its listing return type, and a webhook helper creates a listing with a 10% service-charge modifier. ChangesIntegration test helper relocation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/integration/server/payments/_shared-setup.ts`:
- Line 9: Update the exported fillSoldOutListing helper with an explicit async
return type, using the repository’s named listing type or an equivalent
Promise<Awaited<ReturnType<typeof createTestListing>>> annotation. Keep the
helper’s existing behavior unchanged.
In `@test/integration/server/webhooks/service-charge-scenario.ts`:
- Line 12: Add a named result interface or type for createServiceChargeScenario
and explicitly annotate the exported function with Promise of that type,
preserving the helper’s existing returned shape.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 807363ea-6f2e-4e09-a36f-e2f73c773d2f
📒 Files selected for processing (7)
test/integration/server/payments-success-tokens.test.tstest/integration/server/payments/_shared-setup.tstest/integration/server/payments/replay.test.tstest/integration/server/payments/success.test.tstest/integration/server/webhooks/modifier-refunds.test.tstest/integration/server/webhooks/modifiers.test.tstest/integration/server/webhooks/service-charge-scenario.ts
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/integration/server/payments/_shared-setup.ts`:
- Line 9: Update the exported fillSoldOutListing helper with an explicit async
return type, using the repository’s named listing type or an equivalent
Promise<Awaited<ReturnType<typeof createTestListing>>> annotation. Keep the
helper’s existing behavior unchanged.
In `@test/integration/server/webhooks/service-charge-scenario.ts`:
- Line 12: Add a named result interface or type for createServiceChargeScenario
and explicitly annotate the exported function with Promise of that type,
preserving the helper’s existing returned shape.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 807363ea-6f2e-4e09-a36f-e2f73c773d2f
📒 Files selected for processing (7)
test/integration/server/payments-success-tokens.test.tstest/integration/server/payments/_shared-setup.tstest/integration/server/payments/replay.test.tstest/integration/server/payments/success.test.tstest/integration/server/webhooks/modifier-refunds.test.tstest/integration/server/webhooks/modifiers.test.tstest/integration/server/webhooks/service-charge-scenario.ts
🛑 Comments failed to post (2)
test/integration/server/payments/_shared-setup.ts (1)
9-9: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Declare the exported helper’s return type.
fillSoldOutListingis exported but its async return type is inferred. Add an explicit named listing type (or equivalentPromise<Awaited<ReturnType<typeof createTestListing>>>) as required by the repository guidelines.Proposed fix
+type TestListing = Awaited<ReturnType<typeof createTestListing>>; + -export const fillSoldOutListing = async () => { +export const fillSoldOutListing = async (): Promise<TestListing> => {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.type TestListing = Awaited<ReturnType<typeof createTestListing>>; export const fillSoldOutListing = async (): Promise<TestListing> => {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/integration/server/payments/_shared-setup.ts` at line 9, Update the exported fillSoldOutListing helper with an explicit async return type, using the repository’s named listing type or an equivalent Promise<Awaited<ReturnType<typeof createTestListing>>> annotation. Keep the helper’s existing behavior unchanged.Source: Coding guidelines
test/integration/server/webhooks/service-charge-scenario.ts (1)
12-12: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Add an explicit return type to the exported helper.
createServiceChargeScenariocurrently relies on inference, but exported functions must declare an explicit return type. Add a named result interface/type and annotate the function as returningPromise<...>.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/integration/server/webhooks/service-charge-scenario.ts` at line 12, Add a named result interface or type for createServiceChargeScenario and explicitly annotate the exported function with Promise of that type, preserving the helper’s existing returned shape.Source: Coding guidelines
|
Addressed both CodeRabbit findings (the inline comments failed to post as threads, so replying here).
Both fixes are in commit 2d30489. |
What changed
Moved three payment/webhook test files from
test/lib/to colocate them with the integration suites that already live undertest/integration/server/:test/lib/server-payments-success-tokens.test.ts→test/integration/server/payments-success-tokens.test.tstest/lib/server-payments/_shared-setup.ts→test/integration/server/payments/_shared-setup.tstest/lib/server-webhooks/service-charge-scenario.ts→test/integration/server/webhooks/service-charge-scenario.tsThe two helpers are exact 100% renames. The token suite is detected as a 98% rename because its relative helper import (
./payment-success-helpers.ts) became an aliased one (#test/lib/payment-success-helpers.ts) so Biome re-sorted the import block — no test logic changed.The four suites that imported the moved helpers (
payments/success,payments/replay,webhooks/modifiers,webhooks/modifier-refunds) had only the import path updated to#test/integration/server/....Why
These three files were the last payment/webhook holdouts under
test/lib/while every suite that uses them already lives undertest/integration/server/. Colocating them keeps related tests in one place and matches the mutation mapper's exempttest/integration/prefix, so they're no longer flagged as misplaced unit tests.Verification
deno task test:fileson all five affected suites: 32 passeddeno task test:quality-audit: no findings in any moved or importing suitedeno task precommit: passed (typecheck, lint, cpd, tests)Summary by CodeRabbit