test: [Booking Refactor Preparation - 1] Add new booking validation integration tests#23833
Conversation
WalkthroughAdds a new test suite at packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts covering Email Blacklist Validation and Active Bookings Limit Validation using a shared test harness, Prisma mocks, and mocked calendar availability. Updates apps/web/test/utils/bookingScenario/bookingScenario.ts: the organizer builder now accepts and returns an emailVerified field (Date | null). Reorders an import in tests/libs/mocks/prisma.ts (no behavioral change). No exported/public API signatures were modified. Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) 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. Comment |
|
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details: |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts (3)
380-391: Prefer rejects.toMatchObject over manual try/catch; avoids unknown error type issuesKeeps assertions concise and type-safe, and verifies both message and structured data.
- try { - await handleNewBooking({ - bookingData: mockBookingData, - }); - } catch (error) { - expect(error.message).toEqual("booker_limit_exceeded_error_reschedule"); - expect(error.data).toEqual( - expect.objectContaining({ - rescheduleUid: "existing-booking-1", - }) - ); - } + await expect( + handleNewBooking({ + bookingData: mockBookingData, + }) + ).rejects.toMatchObject({ + message: "booker_limit_exceeded_error_reschedule", + data: expect.objectContaining({ + rescheduleUid: "existing-booking-1", + }), + });
74-81: Redundant verification update?Comment says this “happens in createBookingScenario” yet the test also updates emailVerified. If createBookingScenario already ensures verification, drop this block to shorten runtime; otherwise, update the comment.
27-29: Restore env var to its previous value instead of deletingSafer across parallel/stacked tests. Keep state symmetrical.
Example pattern:
import { beforeEach, afterEach } from "vitest"; let prevBlacklisted: string | undefined; beforeEach(() => { prevBlacklisted = process.env.BLACKLISTED_GUEST_EMAILS; }); afterEach(() => { process.env.BLACKLISTED_GUEST_EMAILS = prevBlacklisted; });
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.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/features/bookings/lib/handleNewBooking/test/booking-validations.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/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts
**/*.{ts,tsx,js,jsx}
⚙️ CodeRabbit configuration file
Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.
Files:
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: hariombalhara
PR: calcom/cal.com#23736
File: packages/features/bookings/lib/reschedule/determineReschedulePreventionRedirect.ts:73-84
Timestamp: 2025-09-12T11:23:34.118Z
Learning: The test file packages/features/bookings/lib/reschedule/determineReschedulePreventionRedirect.test.ts explicitly documents on line 236 that the current behavior of forceRescheduleForCancelledBooking affecting both CANCELLED and REJECTED bookings is known to be incorrect, but is preserved as "Current Behavior" for backward compatibility. The test comment states the expected behavior should be that REJECTED bookings redirect to booking details even when forceRescheduleForCancelledBooking=true.
📚 Learning: 2025-08-27T13:32:46.887Z
Learnt from: supalarry
PR: calcom/cal.com#23364
File: apps/api/v2/src/ee/event-types/event-types_2024_06_14/transformers/internal-to-api/internal-to-api.spec.ts:295-296
Timestamp: 2025-08-27T13:32:46.887Z
Learning: In calcom/cal.com, when transforming booking fields from internal to API format, tests in organizations-event-types.e2e-spec.ts already expect name field label and placeholder to be empty strings ("") rather than undefined. PR changes that set these to explicit empty strings are typically fixing implementation to match existing test expectations rather than breaking changes.
Applied to files:
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts
📚 Learning: 2025-09-12T11:23:34.118Z
Learnt from: hariombalhara
PR: calcom/cal.com#23736
File: packages/features/bookings/lib/reschedule/determineReschedulePreventionRedirect.ts:73-84
Timestamp: 2025-09-12T11:23:34.118Z
Learning: The test file packages/features/bookings/lib/reschedule/determineReschedulePreventionRedirect.test.ts explicitly documents on line 236 that the current behavior of forceRescheduleForCancelledBooking affecting both CANCELLED and REJECTED bookings is known to be incorrect, but is preserved as "Current Behavior" for backward compatibility. The test comment states the expected behavior should be that REJECTED bookings redirect to booking details even when forceRescheduleForCancelledBooking=true.
Applied to files:
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts
🧬 Code graph analysis (1)
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts (2)
packages/features/bookings/lib/handleNewBooking/test/getNewBookingHandler.ts (1)
getNewBookingHandler(6-8)apps/web/test/utils/bookingScenario/bookingScenario.ts (7)
getBooker(2220-2234)getOrganizer(1520-1576)TestData(1239-1511)getGoogleCalendarCredential(1192-1200)createBookingScenario(978-1009)getScenarioData(1578-1664)mockCalendarToHaveNoBusySlots(1960-1973)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Install dependencies / Yarn install & cache
- GitHub Check: Linters / lint
🔇 Additional comments (2)
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts (2)
224-228: Stabilize timeslot selection to avoid accidental conflictsYou seed an existing booking at 10:00 and then create new bookings without explicitly setting the requested slot. If the default slot used by getMockRequestDataForBooking ever lands on 10:00 for the same day, the test will fail for the wrong reason (conflict vs. limit).
If supported, pass an explicit start/end in mockBookingData to ensure it’s not at 10:00 nor overlapping with your seeded bookings.
Also applies to: 248-257
30-33: Good structure and coverageSolid, focused suites for blocklisted emails and active booking limits, leveraging the shared harness correctly.
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts
Outdated
Show resolved
Hide resolved
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts
Show resolved
Hide resolved
921d856 to
4a8659b
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/web/test/utils/bookingScenario/bookingScenario.ts (1)
1537-1538: Default emailVerified to null to avoid tri‑state (undefined|null|Date)Keeps the persisted value shape stable in prismock/Prisma writes.
Apply this diff:
export function getOrganizer({ name, email, id, schedules, credentials, selectedCalendars, destinationCalendar, defaultScheduleId, weekStart = "Sunday", teams, organizationId, metadata, smsLockState, completedOnboarding, username, locked, - emailVerified, + emailVerified = null, }: { name: string; email: string; id: number; organizationId?: number | null; schedules: InputUser["schedules"]; credentials?: InputCredential[]; selectedCalendars?: InputSelectedCalendar[]; defaultScheduleId?: number | null; destinationCalendar?: Prisma.DestinationCalendarCreateInput; weekStart?: WeekDays; teams?: InputUser["teams"]; metadata?: userMetadataType; smsLockState?: SMSLockState; completedOnboarding?: boolean; username?: string; locked?: boolean; emailVerified?: Date | null; })Also applies to: 1555-1555
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
apps/web/test/utils/bookingScenario/bookingScenario.ts(3 hunks)packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts(1 hunks)tests/libs/__mocks__/prisma.ts(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- tests/libs/mocks/prisma.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.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:
apps/web/test/utils/bookingScenario/bookingScenario.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:
apps/web/test/utils/bookingScenario/bookingScenario.ts
**/*.{ts,tsx,js,jsx}
⚙️ CodeRabbit configuration file
Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.
Files:
apps/web/test/utils/bookingScenario/bookingScenario.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: hariombalhara
PR: calcom/cal.com#23736
File: packages/features/bookings/lib/reschedule/determineReschedulePreventionRedirect.ts:73-84
Timestamp: 2025-09-12T11:23:34.118Z
Learning: The test file packages/features/bookings/lib/reschedule/determineReschedulePreventionRedirect.test.ts explicitly documents on line 236 that the current behavior of forceRescheduleForCancelledBooking affecting both CANCELLED and REJECTED bookings is known to be incorrect, but is preserved as "Current Behavior" for backward compatibility. The test comment states the expected behavior should be that REJECTED bookings redirect to booking details even when forceRescheduleForCancelledBooking=true.
📚 Learning: 2025-08-27T13:32:46.887Z
Learnt from: supalarry
PR: calcom/cal.com#23364
File: apps/api/v2/src/ee/event-types/event-types_2024_06_14/transformers/internal-to-api/internal-to-api.spec.ts:295-296
Timestamp: 2025-08-27T13:32:46.887Z
Learning: In calcom/cal.com, when transforming booking fields from internal to API format, tests in organizations-event-types.e2e-spec.ts already expect name field label and placeholder to be empty strings ("") rather than undefined. PR changes that set these to explicit empty strings are typically fixing implementation to match existing test expectations rather than breaking changes.
Applied to files:
apps/web/test/utils/bookingScenario/bookingScenario.ts
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (2)
apps/web/test/utils/bookingScenario/bookingScenario.ts (2)
1537-1556: LGTM: added emailVerified to organizer input type and paramsThis unblocks tests that need to toggle verified/unverified users.
1577-1578: Ensure Prisma User model includes emailVerifiedNo
emailVerifiedfield found in the checked schema.prisma files — confirm the User model definesemailVerified(e.g.emailVerified DateTime?) socreateManydoesn't silently drop it. Files inspected: packages/platform/examples/base/prisma/schema.prisma, packages/prisma/schema.prisma.
E2E results are ready! |
c892627 to
b076724
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts (1)
82-82: Don’t pass{}to mockCalendarToHaveNoBusySlots; it disables built‑in defaults.Passing
{}overrides the helper’s default create/update payloads and can cause flaky behavior; just call the helper with the metadata key.- await mockCalendarToHaveNoBusySlots("googlecalendar", {}); + await mockCalendarToHaveNoBusySlots("googlecalendar");(Apply at Lines 82, 158, 236, 338.)
Also applies to: 158-158, 236-236, 338-338
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
apps/web/test/utils/bookingScenario/bookingScenario.ts(3 hunks)packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts(1 hunks)tests/libs/__mocks__/prisma.ts(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- tests/libs/mocks/prisma.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/web/test/utils/bookingScenario/bookingScenario.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.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/features/bookings/lib/handleNewBooking/test/booking-validations.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/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts
**/*.{ts,tsx,js,jsx}
⚙️ CodeRabbit configuration file
Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.
Files:
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: supalarry
PR: calcom/cal.com#23364
File: apps/api/v2/src/ee/event-types/event-types_2024_06_14/transformers/internal-to-api/internal-to-api.spec.ts:295-296
Timestamp: 2025-08-27T13:32:46.887Z
Learning: In calcom/cal.com, when transforming booking fields from internal to API format, tests in organizations-event-types.e2e-spec.ts already expect name field label and placeholder to be empty strings ("") rather than undefined. PR changes that set these to explicit empty strings are typically fixing implementation to match existing test expectations rather than breaking changes.
📚 Learning: 2025-08-27T13:32:46.887Z
Learnt from: supalarry
PR: calcom/cal.com#23364
File: apps/api/v2/src/ee/event-types/event-types_2024_06_14/transformers/internal-to-api/internal-to-api.spec.ts:295-296
Timestamp: 2025-08-27T13:32:46.887Z
Learning: In calcom/cal.com, when transforming booking fields from internal to API format, tests in organizations-event-types.e2e-spec.ts already expect name field label and placeholder to be empty strings ("") rather than undefined. PR changes that set these to explicit empty strings are typically fixing implementation to match existing test expectations rather than breaking changes.
Applied to files:
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts
📚 Learning: 2025-09-12T11:23:34.118Z
Learnt from: hariombalhara
PR: calcom/cal.com#23736
File: packages/features/bookings/lib/reschedule/determineReschedulePreventionRedirect.ts:73-84
Timestamp: 2025-09-12T11:23:34.118Z
Learning: The test file packages/features/bookings/lib/reschedule/determineReschedulePreventionRedirect.test.ts explicitly documents on line 236 that the current behavior of forceRescheduleForCancelledBooking affecting both CANCELLED and REJECTED bookings is known to be incorrect, but is preserved as "Current Behavior" for backward compatibility. The test comment states the expected behavior should be that REJECTED bookings redirect to booking details even when forceRescheduleForCancelledBooking=true.
Applied to files:
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts
🧬 Code graph analysis (1)
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts (2)
packages/features/bookings/lib/handleNewBooking/test/getNewBookingHandler.ts (1)
getNewBookingHandler(6-8)apps/web/test/utils/bookingScenario/bookingScenario.ts (7)
getBooker(2223-2237)getOrganizer(1520-1579)TestData(1239-1511)getGoogleCalendarCredential(1192-1200)createBookingScenario(978-1009)getScenarioData(1581-1667)mockCalendarToHaveNoBusySlots(1963-1976)
🪛 Biome (2.1.2)
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts
[error] 13-13: Illegal use of await as an identifier in an async context
(parse)
[error] 13-13: expected , but instead found mockCalendarToHaveNoBusySlots
Remove mockCalendarToHaveNoBusySlots
(parse)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Production builds / Build API v1
- GitHub Check: Type check / check-types
- GitHub Check: Tests / Unit
- GitHub Check: Production builds / Build Web App
🔇 Additional comments (1)
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts (1)
180-182: Clarify timer mocking: vi.setSystemTime only fixes Date. without vi.useFakeTimers — enable fake timers only if you need timers/hrtime/performance mocked.*Vitest's vi.setSystemTime will mock Date.* even when fake timers are not enabled; it does not simulate hrtime/performance.now or other timer behavior. (vitest.dev)
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts (lines 180, 270) calls vi.setSystemTime(...) without vi.useFakeTimers(); if the test only needs Date to be fixed, no change is required — if it relies on timers/hrtime/performance, wrap the test with vi.useFakeTimers() and restore with vi.useRealTimers().
Likely an incorrect or invalid review comment.
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts
Outdated
Show resolved
Hide resolved
| try { | ||
| await handleNewBooking({ | ||
| bookingData: mockBookingData, | ||
| }); | ||
| } catch (error) { | ||
| expect(error.message).toEqual("booker_limit_exceeded_error_reschedule"); | ||
| expect(error.data).toEqual( | ||
| expect.objectContaining({ | ||
| rescheduleUid: "existing-booking-1", | ||
| }) | ||
| ); | ||
| } |
There was a problem hiding this comment.
Avoid false positives: assert rejection without try/catch.
If no error is thrown, the current test passes silently. Use .rejects to ensure the promise must reject.
- try {
- await handleNewBooking({
- bookingData: mockBookingData,
- });
- } catch (error) {
- expect(error.message).toEqual("booker_limit_exceeded_error_reschedule");
- expect(error.data).toEqual(
- expect.objectContaining({
- rescheduleUid: "existing-booking-1",
- })
- );
- }
+ await expect(
+ handleNewBooking({ bookingData: mockBookingData })
+ ).rejects.toMatchObject({
+ message: "booker_limit_exceeded_error_reschedule",
+ data: expect.objectContaining({ rescheduleUid: "existing-booking-1" }),
+ });📝 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.
| try { | |
| await handleNewBooking({ | |
| bookingData: mockBookingData, | |
| }); | |
| } catch (error) { | |
| expect(error.message).toEqual("booker_limit_exceeded_error_reschedule"); | |
| expect(error.data).toEqual( | |
| expect.objectContaining({ | |
| rescheduleUid: "existing-booking-1", | |
| }) | |
| ); | |
| } | |
| await expect( | |
| handleNewBooking({ bookingData: mockBookingData }) | |
| ).rejects.toMatchObject({ | |
| message: "booker_limit_exceeded_error_reschedule", | |
| data: expect.objectContaining({ rescheduleUid: "existing-booking-1" }), | |
| }); |
🤖 Prompt for AI Agents
In
packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts
around lines 351–362, replace the try/catch pattern with an explicit assertion
that the promise rejects: call await expect(handleNewBooking({ bookingData:
mockBookingData })).rejects and assert the rejection shape (for example using
.rejects.toMatchObject({ message: "booker_limit_exceeded_error_reschedule",
data: expect.objectContaining({ rescheduleUid: "existing-booking-1" }) })) so
the test fails if no error is thrown.
b076724 to
2d3b58b
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/web/test/utils/bookingScenario/bookingScenario.ts (1)
1537-1556: Set a default for emailVerified and align types.Defaulting to null avoids undefined/null ambiguity in tests and DB writes. Also, consider adding emailVerified to InputUser for explicit typing.
Apply this minimal diff to default the param:
export function getOrganizer({ @@ locked, - emailVerified, + emailVerified = null, }: { @@ - emailVerified?: Date | null; + emailVerified?: Date | null; }) { @@ locked, emailVerified, }; }And update the helper type (outside this hunk) so users are explicitly typed with the new field:
// In type InputUser ... add: emailVerified?: Date | null;Verify the Prisma schema actually has this column to prevent runtime “Unknown arg” errors:
#!/bin/bash # Verify User model exposes `emailVerified` rg -nP -C2 '(?s)^model\s+User\b.*?\bemailVerified\b' prisma | catAlso applies to: 1577-1578
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
apps/web/test/utils/bookingScenario/bookingScenario.ts(3 hunks)packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts(1 hunks)tests/libs/__mocks__/prisma.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/features/bookings/lib/handleNewBooking/test/booking-validations.test.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.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:
apps/web/test/utils/bookingScenario/bookingScenario.tstests/libs/__mocks__/prisma.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:
apps/web/test/utils/bookingScenario/bookingScenario.tstests/libs/__mocks__/prisma.ts
**/*.{ts,tsx,js,jsx}
⚙️ CodeRabbit configuration file
Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.
Files:
apps/web/test/utils/bookingScenario/bookingScenario.tstests/libs/__mocks__/prisma.ts
🧠 Learnings (4)
📓 Common learnings
Learnt from: supalarry
PR: calcom/cal.com#23364
File: apps/api/v2/src/ee/event-types/event-types_2024_06_14/transformers/internal-to-api/internal-to-api.spec.ts:295-296
Timestamp: 2025-08-27T13:32:46.887Z
Learning: In calcom/cal.com, when transforming booking fields from internal to API format, tests in organizations-event-types.e2e-spec.ts already expect name field label and placeholder to be empty strings ("") rather than undefined. PR changes that set these to explicit empty strings are typically fixing implementation to match existing test expectations rather than breaking changes.
📚 Learning: 2025-08-27T13:32:46.887Z
Learnt from: supalarry
PR: calcom/cal.com#23364
File: apps/api/v2/src/ee/event-types/event-types_2024_06_14/transformers/internal-to-api/internal-to-api.spec.ts:295-296
Timestamp: 2025-08-27T13:32:46.887Z
Learning: In calcom/cal.com, when transforming booking fields from internal to API format, tests in organizations-event-types.e2e-spec.ts already expect name field label and placeholder to be empty strings ("") rather than undefined. PR changes that set these to explicit empty strings are typically fixing implementation to match existing test expectations rather than breaking changes.
Applied to files:
apps/web/test/utils/bookingScenario/bookingScenario.ts
📚 Learning: 2025-08-27T16:39:38.192Z
Learnt from: anglerfishlyy
PR: calcom/cal.com#0
File: :0-0
Timestamp: 2025-08-27T16:39:38.192Z
Learning: anglerfishlyy successfully implemented CAL-3076 email invitation feature for Cal.com team event-types in PR #23312. The feature allows inviting people via email directly from assignment flow, with automatic team invitation if email doesn't belong to existing team member. Implementation includes Host type modifications (userId?: number, email?: string, isPending?: boolean), CheckedTeamSelect component updates with CreatableSelect, TRPC schema validation with zod email validation, and integration with existing teamInvite system.
Applied to files:
apps/web/test/utils/bookingScenario/bookingScenario.ts
📚 Learning: 2025-09-09T03:29:43.025Z
Learnt from: emrysal
PR: calcom/cal.com#23692
File: packages/lib/server/service/InsightsBookingBaseService.ts:16-16
Timestamp: 2025-09-09T03:29:43.025Z
Learning: In the Cal.com codebase, readonlyPrisma is still an instance of PrismaClient, making type changes from `typeof readonlyPrisma` to `PrismaClient` less critical since they are fundamentally compatible types.
Applied to files:
tests/libs/__mocks__/prisma.ts
🔇 Additional comments (1)
tests/libs/__mocks__/prisma.ts (1)
5-7: Import reorder is fine.No behavior change; keeps selects available before spreading into the vi.mock factory. LGTM.

What does this PR do?
Add integration tests for new booking to prepare for moving the validation related code to BookingValidationService