Skip to content

Commit 95d6235

Browse files
authored
test: update flaky tests (calcom#21419)
* test: update flaky integration tests * change limit
1 parent b9fadf8 commit 95d6235

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

packages/features/insights/__tests__/booking-denormalized.integration-test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ describe("BookingDenormalized", () => {
99
let bookingId: number;
1010
const randomId = Math.floor(Math.random() * 1000000);
1111
const email = `booking-denorm-${randomId}@example.com`;
12+
const updatedEmail = `updated-${email}`;
1213

1314
beforeEach(async () => {
1415
// Create test user
@@ -101,7 +102,7 @@ describe("BookingDenormalized", () => {
101102
where: { id: userId },
102103
data: {
103104
name: "Updated User",
104-
105+
email: updatedEmail,
105106
},
106107
});
107108

@@ -110,7 +111,7 @@ describe("BookingDenormalized", () => {
110111
});
111112

112113
expect(userUpdatedDenormalizedBooking.userName).toBe("Updated User");
113-
expect(userUpdatedDenormalizedBooking.userEmail).toBe("[email protected]");
114+
expect(userUpdatedDenormalizedBooking.userEmail).toBe(updatedEmail);
114115
});
115116

116117
it("should update denormalized entry when event type is updated", async () => {

packages/features/insights/__tests__/routing-form-response-denormalized.integration-test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ describe("RoutingFormResponseDenormalized", () => {
1212
let bookingId: number;
1313
let responseId: number;
1414
const randomId = Math.floor(Math.random() * 1000000);
15-
const email = `booking-denorm-${randomId}@example.com`;
15+
const email = `routing-form-response-denorm-${randomId}@example.com`;
16+
const updatedEmail = `updated-${email}`;
1617

1718
beforeEach(async () => {
1819
// Create test user
1920
const user = await prisma.user.create({
2021
data: {
2122
email,
22-
username: `booking-denorm-testuser-${randomId}`,
23+
username: `routing-form-response-denorm-testuser-${randomId}`,
2324
name: "Test User",
2425
},
2526
});
@@ -96,7 +97,7 @@ describe("RoutingFormResponseDenormalized", () => {
9697
// Create test booking
9798
const booking = await prisma.booking.create({
9899
data: {
99-
uid: `booking-denorm-${randomId}`,
100+
uid: `routing-form-response-denorm-${randomId}`,
100101
title: "Test Booking",
101102
startTime: new Date(),
102103
endTime: new Date(Date.now() + 60 * 60 * 1000),
@@ -254,7 +255,7 @@ describe("RoutingFormResponseDenormalized", () => {
254255
where: { id: userId },
255256
data: {
256257
name: "Updated User",
257-
258+
email: updatedEmail,
258259
},
259260
});
260261

@@ -263,7 +264,7 @@ describe("RoutingFormResponseDenormalized", () => {
263264
});
264265

265266
expect(denormalizedResponse.bookingUserName).toBe("Updated User");
266-
expect(denormalizedResponse.bookingUserEmail).toBe("[email protected]");
267+
expect(denormalizedResponse.bookingUserEmail).toBe(updatedEmail);
267268
});
268269

269270
it("should update denormalized entry when booking is updated", async () => {
@@ -636,7 +637,7 @@ describe("RoutingFormResponseDenormalized", () => {
636637
// Create a booking with attendees
637638
const booking = await prisma.booking.create({
638639
data: {
639-
uid: `booking-denorm-${Math.floor(Math.random() * 1000000)}`,
640+
uid: `routing-form-response-denorm-${Math.floor(Math.random() * 1000000)}`,
640641
title: "Test Booking",
641642
startTime: new Date(),
642643
endTime: new Date(Date.now() + 60 * 60 * 1000),

packages/lib/slots.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ describe("Tests the slots function performance", () => {
392392
const endTime = process.hrtime(startTime);
393393
const executionTimeInMs = endTime[0] * 1000 + endTime[1] / 1000000;
394394

395-
expect(executionTimeInMs).toBeLessThan(2000); // less than 2 seconds for 2000 date ranges
395+
expect(executionTimeInMs).toBeLessThan(3000); // less than 3 seconds for 2000 date ranges
396396

397397
console.log(
398398
`Performance test completed in ${executionTimeInMs}ms with ${result.length} slots generated from ${dateRanges.length} date ranges`

0 commit comments

Comments
 (0)