fix: allow new booking to overlap old one when rescheduling (#10424)

Co-authored-by: CarinaWolli <[email protected]>
This commit is contained in:
Carina WollendorferandCarinaWolli authored and GitHub committed 2023-08-10 19:07:57 +00:00
1 parent c7dfa7bc89
commit a6daf17909
8 files changed
+107 -37

No files matched your search

+24
View File
@@ -1,5 +1,6 @@
import { expect } from "@playwright/test";
import dayjs from "@calcom/dayjs";
import prisma from "@calcom/prisma";
import { BookingStatus } from "@calcom/prisma/enums";
@@ -239,4 +240,27 @@ test.describe("Reschedule Tests", async () => {
expect(newBooking).not.toBeNull();
expect(newBooking?.status).toBe(BookingStatus.ACCEPTED);
});
test("Should be able to book slot that overlaps with original rescheduled booking", async ({
page,
users,
bookings,
}) => {
const user = await users.create();
const eventType = user.eventTypes[0];
const startTime = dayjs().add(1, "day").set("hour", 10).set("minute", 0).toDate();
const endTime = dayjs().add(1, "day").set("hour", 10).set("minute", 30).toDate();
const booking = await bookings.create(user.id, user.username, eventType.id, {}, startTime, endTime);
await page.goto(`/reschedule/${booking.uid}`);
//book same slot again
page.getByRole("button", { name: dayjs(startTime).format("D"), exact: true }).click();
page.getByRole("button", { name: dayjs(startTime).format("h:mmA") }).click();
await page.locator('[data-testid="confirm-reschedule-button"]').click();
await expect(page).toHaveURL(/.*booking/);
});
});