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
chore: Add test for booking cancelled webhook #14940
chore: Add test for booking cancelled webhook #14940
Conversation
@Amit91848 is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link. |
Graphite Automations"Add community label" took an action on this PR • (05/08/24)1 label was added to this PR based on Keith Williams's automation. "Add consumer team as reviewer" took an action on this PR • (05/08/24)1 reviewer was added to this PR based on Keith Williams's automation. |
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
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.
@Amit91848 we wanted unit tests here. one of the contributor created this function expectBookingCancelledWebhookToHaveBeenFired (https://github.com/calcom/cal.com/pull/14745/files) which we can use.
apps/web/playwright/webhook.e2e.ts
Outdated
@@ -164,6 +164,121 @@ test.describe("BOOKING_CREATED", async () => { | |||
}); | |||
}); | |||
|
|||
test.describe("BOOKING_CANCELLED", async () => { |
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.
can you remove this E2E test?
const createdBooking = await handleNewBooking(mockCreateBookingReq); | ||
|
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.
you need to add some assertions to make sure booking was created successfully.
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.
you can check other unit test
Unit test passes but there is an error thrown when cancelling scheduled jobs When booking is created scheduledJobs is null But when you fetch it from database it converts to an object?? Like here |
organizer: { | ||
id: organizer.id, | ||
username: organizer.username, | ||
email: organizer.email, | ||
name: organizer.name, | ||
timeZone: organizer.timeZone, |
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.
I added this new test instead.
we just wanted to test booking cancelled so i just created a dummy booking using getScenarioData
and also you skipped checking if organizer id is passed in payload which is the main thing that needs to be checked
What does this PR do?
Fixes #14886
Fixes CAL-3641
Type of change
How should this be tested?
yarn test cancel.test.ts
Mandatory Tasks