-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: require confirmation cal video bug #16376
Merged
+123
−7
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
fd37baa
fix: require confirmation cal video bug
Udit-takkar 2347e74
chore: update location
Udit-takkar 10405a8
fix: tests
Udit-takkar 537ed4b
chore
Udit-takkar e680ed9
test: add confirm booking test
Udit-takkar 5fe99ba
chore: add location in test
Udit-takkar fad74b8
fix: types
Udit-takkar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
110 changes: 110 additions & 0 deletions
110
packages/trpc/server/routers/viewer/bookings/confirm.handler.test.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import { | ||
createBookingScenario, | ||
TestData, | ||
getOrganizer, | ||
getScenarioData, | ||
mockSuccessfulVideoMeetingCreation, | ||
getDate, | ||
} from "@calcom/web/test/utils/bookingScenario/bookingScenario"; | ||
import { setupAndTeardown } from "@calcom/web/test/utils/bookingScenario/setupAndTeardown"; | ||
|
||
import { describe, it, beforeEach, vi, expect } from "vitest"; | ||
|
||
import { BookingStatus } from "@calcom/prisma/enums"; | ||
|
||
import type { TrpcSessionUser } from "../../../trpc"; | ||
import { confirmHandler } from "./confirm.handler"; | ||
|
||
describe("confirmHandler", () => { | ||
setupAndTeardown(); | ||
beforeEach(() => { | ||
// Reset all mocks before each test | ||
vi.clearAllMocks(); | ||
}); | ||
|
||
it("should successfully confirm booking when event type doesn't have any default location", async () => { | ||
const attendeeUser = getOrganizer({ | ||
email: "test@example.com", | ||
name: "test name", | ||
id: 102, | ||
schedules: [TestData.schedules.IstWorkHours], | ||
}); | ||
|
||
const organizer = getOrganizer({ | ||
name: "Organizer", | ||
email: "organizer@example.com", | ||
id: 101, | ||
schedules: [TestData.schedules.IstWorkHours], | ||
}); | ||
|
||
const uidOfBooking = "n5Wv3eHgconAED2j4gcVhP"; | ||
const iCalUID = `${uidOfBooking}@Cal.com`; | ||
|
||
const { dateString: plus1DateString } = getDate({ dateIncrement: 1 }); | ||
|
||
await createBookingScenario( | ||
getScenarioData({ | ||
webhooks: [ | ||
{ | ||
userId: organizer.id, | ||
eventTriggers: ["BOOKING_CREATED"], | ||
subscriberUrl: "http://my-webhook.example.com", | ||
active: true, | ||
eventTypeId: 1, | ||
appId: null, | ||
}, | ||
], | ||
eventTypes: [ | ||
{ | ||
id: 1, | ||
slotInterval: 15, | ||
length: 15, | ||
locations: [], | ||
users: [ | ||
{ | ||
id: 101, | ||
}, | ||
], | ||
}, | ||
], | ||
bookings: [ | ||
{ | ||
id: 101, | ||
uid: uidOfBooking, | ||
eventTypeId: 1, | ||
status: BookingStatus.PENDING, | ||
startTime: `${plus1DateString}T05:00:00.000Z`, | ||
endTime: `${plus1DateString}T05:15:00.000Z`, | ||
references: [], | ||
iCalUID, | ||
location: "integrations:daily", | ||
attendees: [attendeeUser], | ||
responses: { name: attendeeUser.name, email: attendeeUser.email, guests: [] }, | ||
}, | ||
], | ||
organizer, | ||
apps: [TestData.apps["daily-video"]], | ||
}) | ||
); | ||
|
||
mockSuccessfulVideoMeetingCreation({ | ||
metadataLookupKey: "dailyvideo", | ||
}); | ||
|
||
const ctx = { | ||
user: { | ||
id: organizer.id, | ||
name: organizer.name, | ||
timeZone: organizer.timeZone, | ||
username: organizer.username, | ||
} as NonNullable<TrpcSessionUser>, | ||
}; | ||
|
||
const res = await confirmHandler({ | ||
ctx, | ||
input: { bookingId: 101, confirmed: true, reason: "" }, | ||
}); | ||
|
||
expect(res?.status).toBe(BookingStatus.ACCEPTED); | ||
}); | ||
}); |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When an event type doesn't have any location set and user submits booking form there is no location field in responses causing Type error "Cannot set properties of undefined"