fix: Type error in inviteMember.handler test#23070
Conversation
WalkthroughThe integration test file packages/trpc/server/routers/viewer/teams/inviteMember/inviteMember.handler.integration-test.ts updates the createTestTeam helper’s TypeScript signature. Within the optional organizationSettings object, orgAutoAcceptEmail is changed from optional to required (string). No runtime logic or other files are modified. Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Graphite Automations"Add foundation team as reviewer" took an action on this PR • (08/14/25)1 reviewer was added to this PR based on Keith Williams's automation. "Add ready-for-e2e label" took an action on this PR • (08/14/25)1 label was added to this PR based on Keith Williams's automation. |
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
packages/trpc/server/routers/viewer/teams/inviteMember/inviteMember.handler.integration-test.ts (1)
219-219: Boolean default bug: don’t override explicit falseUsing
|| truecoerces false to true. Use nullish coalescing to preserve false.Apply this diff:
- allowDynamicBooking: user.allowDynamicBooking || true, + allowDynamicBooking: user.allowDynamicBooking ?? true,
🧹 Nitpick comments (1)
packages/trpc/server/routers/viewer/teams/inviteMember/inviteMember.handler.integration-test.ts (1)
81-91: Optional: strengthen the input type with a discriminated unionYou can make misuse impossible at the type level (e.g., prevent passing organizationSettings for non-org teams and require it for orgs).
Consider:
type OrganizationSettingsInput = { orgAutoAcceptEmail: string; isOrganizationVerified?: boolean; }; type OrgTeamInput = { name: string; slug: string; isOrganization: true; parentId?: number; // if orgs should never have parent, set this to never metadata?: any; organizationSettings: OrganizationSettingsInput; }; type NonOrgTeamInput = { name: string; slug: string; isOrganization?: false; parentId?: number; metadata?: any; organizationSettings?: never; }; async function createTestTeam( data: OrgTeamInput | NonOrgTeamInput ): Promise<Team> { // ... }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/trpc/server/routers/viewer/teams/inviteMember/inviteMember.handler.integration-test.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.ts
📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)
**/*.ts: For Prisma queries, only select data you need; never useinclude, always useselect
Ensure thecredential.keyfield is never returned from tRPC endpoints or APIs
Files:
packages/trpc/server/routers/viewer/teams/inviteMember/inviteMember.handler.integration-test.ts
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)
Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js
.utc()in hot paths like loops
Files:
packages/trpc/server/routers/viewer/teams/inviteMember/inviteMember.handler.integration-test.ts
🔇 Additional comments (1)
packages/trpc/server/routers/viewer/teams/inviteMember/inviteMember.handler.integration-test.ts (1)
88-90: LGTM: making orgAutoAcceptEmail required is the right fixTightening the type to require orgAutoAcceptEmail inside organizationSettings aligns with how the helper is used in this test and prevents the silent type hole that previously existed. No runtime impact.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
E2E results are ready! |
What does this PR do?
Type check should've failed here but didn't - this fixes that type error.