chore: Enable prettier on vitest files without causing test failures (#11190)
This commit is contained in:
parent
3a05ae6f74
commit
2591ad12df
|
@ -7,7 +7,6 @@ public
|
|||
|
||||
*.lock
|
||||
*.log
|
||||
*.test.ts
|
||||
|
||||
.gitignore
|
||||
.npmignore
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
public/embed
|
||||
*.test.ts
|
||||
public/embed
|
|
@ -11,18 +11,17 @@ it("correctly handles 1 day", async () => {
|
|||
startTime: new Date(Date.UTC(1970, 1, 1, 9, 0, 0, 0)),
|
||||
endTime: new Date(Date.UTC(1970, 1, 1, 17, 0, 0, 0)),
|
||||
date: null,
|
||||
scheduleId: 1
|
||||
scheduleId: 1,
|
||||
};
|
||||
|
||||
const result = availabilityAsString(availability, {
|
||||
locale: 'en',
|
||||
hour12: true
|
||||
locale: "en",
|
||||
hour12: true,
|
||||
});
|
||||
|
||||
expect(replaceUnicodeSpace(result)).toBe("Mon, 9:00 AM - 5:00 PM");
|
||||
});
|
||||
|
||||
|
||||
it("correctly handles all days", async () => {
|
||||
const availability = {
|
||||
id: 1,
|
||||
|
@ -32,12 +31,12 @@ it("correctly handles all days", async () => {
|
|||
startTime: new Date(Date.UTC(1970, 1, 1, 9, 0, 0, 0)),
|
||||
endTime: new Date(Date.UTC(1970, 1, 1, 17, 0, 0, 0)),
|
||||
date: null,
|
||||
scheduleId: 1
|
||||
scheduleId: 1,
|
||||
};
|
||||
|
||||
const result = availabilityAsString(availability, {
|
||||
locale: 'en',
|
||||
hour12: true
|
||||
locale: "en",
|
||||
hour12: true,
|
||||
});
|
||||
|
||||
expect(replaceUnicodeSpace(result)).toBe("Mon - Sun, 9:00 AM - 5:00 PM");
|
||||
|
@ -52,12 +51,12 @@ it("correctly handles staggered days", async () => {
|
|||
startTime: new Date(Date.UTC(1970, 1, 1, 9, 0, 0, 0)),
|
||||
endTime: new Date(Date.UTC(1970, 1, 1, 17, 0, 0, 0)),
|
||||
date: null,
|
||||
scheduleId: 1
|
||||
scheduleId: 1,
|
||||
};
|
||||
|
||||
const result = availabilityAsString(availability, {
|
||||
locale: 'en',
|
||||
hour12: true
|
||||
locale: "en",
|
||||
hour12: true,
|
||||
});
|
||||
|
||||
expect(replaceUnicodeSpace(result)).toBe("Mon, Wed, Fri, Sun, 9:00 AM - 5:00 PM");
|
||||
|
@ -72,12 +71,12 @@ it("correctly produces days and times - 12 hours", async () => {
|
|||
startTime: new Date(Date.UTC(1970, 1, 1, 9, 0, 0, 0)),
|
||||
endTime: new Date(Date.UTC(1970, 1, 1, 17, 0, 0, 0)),
|
||||
date: null,
|
||||
scheduleId: 1
|
||||
scheduleId: 1,
|
||||
};
|
||||
|
||||
const result = availabilityAsString(availability, {
|
||||
locale: 'en',
|
||||
hour12: true
|
||||
locale: "en",
|
||||
hour12: true,
|
||||
});
|
||||
|
||||
expect(replaceUnicodeSpace(result)).toBe("Mon - Wed, 9:00 AM - 5:00 PM");
|
||||
|
@ -92,12 +91,12 @@ it("correctly produces days and times - 24 hours", async () => {
|
|||
startTime: new Date(Date.UTC(1970, 1, 1, 9, 0, 0, 0)),
|
||||
endTime: new Date(Date.UTC(1970, 1, 1, 17, 0, 0, 0)),
|
||||
date: null,
|
||||
scheduleId: 1
|
||||
scheduleId: 1,
|
||||
};
|
||||
|
||||
const result = availabilityAsString(availability, {
|
||||
locale: 'en',
|
||||
hour12: false
|
||||
locale: "en",
|
||||
hour12: false,
|
||||
});
|
||||
|
||||
expect(replaceUnicodeSpace(result)).toBe("Mon - Wed, 09:00 - 17:00");
|
||||
|
@ -107,5 +106,5 @@ it("correctly produces days and times - 24 hours", async () => {
|
|||
// produces Unicode characters. Instead of using line for line code from the
|
||||
// availability.ts file, opted for this instead.
|
||||
const replaceUnicodeSpace = (string: string) => {
|
||||
return string.replace(/\u202f/g, ' ');
|
||||
}
|
||||
return string.replace(/\u202f/g, " ");
|
||||
};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import prismaMock from "../../../../tests/libs/__mocks__/prisma";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import dayjs from "@calcom/dayjs";
|
||||
import { validateIntervalLimitOrder } from "@calcom/lib";
|
||||
import { checkBookingLimits, checkBookingLimit } from "@calcom/lib/server";
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import prismaMock from "../../../../tests/libs/__mocks__/prisma";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import dayjs from "@calcom/dayjs";
|
||||
import { validateIntervalLimitOrder } from "@calcom/lib";
|
||||
import { checkDurationLimit, checkDurationLimits } from "@calcom/lib/server";
|
||||
|
||||
|
||||
type MockData = {
|
||||
id: number;
|
||||
startDate: Date;
|
||||
|
|
|
@ -2,10 +2,9 @@ import { expect, it, beforeAll, vi } from "vitest";
|
|||
|
||||
import { getAggregateWorkingHours } from "@calcom/core/getAggregateWorkingHours";
|
||||
|
||||
|
||||
beforeAll(() => {
|
||||
vi.setSystemTime(new Date("2021-06-20T11:59:59Z"));
|
||||
})
|
||||
});
|
||||
|
||||
const HAWAII_AND_NEWYORK_TEAM = [
|
||||
{
|
||||
|
|
|
@ -4,10 +4,9 @@ import { expect, it, beforeAll, vi } from "vitest";
|
|||
import dayjs from "@calcom/dayjs";
|
||||
import { getAvailabilityFromSchedule } from "@calcom/lib/availability";
|
||||
|
||||
|
||||
beforeAll(() => {
|
||||
vi.setSystemTime(new Date("2021-06-20T11:59:59Z"));
|
||||
})
|
||||
});
|
||||
|
||||
//parse "hh:mm-hh:mm" into <Availability> object
|
||||
const parseWorkingHours = (workingHours: string) => {
|
||||
|
|
|
@ -8,6 +8,7 @@ import prisma from "@calcom/prisma";
|
|||
import type { BookingStatus } from "@calcom/prisma/enums";
|
||||
import type { Slot } from "@calcom/trpc/server/routers/viewer/slots/types";
|
||||
import { getAvailableSlots as getSchedule } from "@calcom/trpc/server/routers/viewer/slots/util";
|
||||
|
||||
import { getDate, getGoogleCalendarCredential, createBookingScenario } from "../utils/bookingScenario";
|
||||
|
||||
// TODO: Mock properly
|
||||
|
@ -16,7 +17,7 @@ prismaMock.user.findMany.mockResolvedValue([]);
|
|||
|
||||
vi.mock("@calcom/lib/constants", () => ({
|
||||
IS_PRODUCTION: true,
|
||||
WEBAPP_URL: "http://localhost:3000"
|
||||
WEBAPP_URL: "http://localhost:3000",
|
||||
}));
|
||||
|
||||
declare global {
|
||||
|
@ -143,7 +144,6 @@ const TestData = {
|
|||
},
|
||||
};
|
||||
|
||||
|
||||
const cleanup = async () => {
|
||||
await prisma.eventType.deleteMany();
|
||||
await prisma.user.deleteMany();
|
||||
|
@ -296,7 +296,7 @@ describe("getSchedule", () => {
|
|||
endTime: `${plus2DateString}T18:29:59.999Z`,
|
||||
timeZone: Timezones["+5:30"],
|
||||
isTeamEvent: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// getSchedule returns timeslots in GMT
|
||||
|
@ -328,7 +328,7 @@ describe("getSchedule", () => {
|
|||
endTime: `${plus3DateString}T18:29:59.999Z`,
|
||||
timeZone: Timezones["+5:30"],
|
||||
isTeamEvent: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
expect(scheduleForDayWithOneBooking).toHaveTimeSlots(
|
||||
|
@ -393,7 +393,7 @@ describe("getSchedule", () => {
|
|||
endTime: `${plus2DateString}T18:29:59.999Z`,
|
||||
timeZone: Timezones["+5:30"],
|
||||
isTeamEvent: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
expect(scheduleForEventWith30Length).toHaveTimeSlots(
|
||||
|
@ -429,7 +429,7 @@ describe("getSchedule", () => {
|
|||
endTime: `${plus2DateString}T18:29:59.999Z`,
|
||||
timeZone: Timezones["+5:30"],
|
||||
isTeamEvent: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
// `slotInterval` takes precedence over `length`
|
||||
// 4:30 is utc so it is 10:00 in IST
|
||||
|
@ -493,7 +493,7 @@ describe("getSchedule", () => {
|
|||
endTime: `${todayDateString}T18:29:59.999Z`,
|
||||
timeZone: Timezones["+5:30"],
|
||||
isTeamEvent: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
expect(scheduleForEventWithBookingNotice13Hrs).toHaveTimeSlots(
|
||||
[
|
||||
|
@ -514,7 +514,7 @@ describe("getSchedule", () => {
|
|||
endTime: `${todayDateString}T18:29:59.999Z`,
|
||||
timeZone: Timezones["+5:30"],
|
||||
isTeamEvent: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
expect(scheduleForEventWithBookingNotice10Hrs).toHaveTimeSlots(
|
||||
[
|
||||
|
@ -578,7 +578,7 @@ describe("getSchedule", () => {
|
|||
endTime: `${plus3DateString}T18:29:59.999Z`,
|
||||
timeZone: Timezones["+5:30"],
|
||||
isTeamEvent: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
expect(scheduleForEventOnADayWithNonCalBooking).toHaveTimeSlots(
|
||||
|
@ -652,7 +652,7 @@ describe("getSchedule", () => {
|
|||
endTime: `${plus2DateString}T18:29:59.999Z`,
|
||||
timeZone: Timezones["+5:30"],
|
||||
isTeamEvent: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
expect(scheduleForEventOnADayWithCalBooking).toHaveTimeSlots(
|
||||
|
@ -710,7 +710,7 @@ describe("getSchedule", () => {
|
|||
endTime: `${plus2DateString}T18:29:59.999Z`,
|
||||
timeZone: Timezones["+5:30"],
|
||||
isTeamEvent: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
expect(schedule).toHaveTimeSlots(
|
||||
|
@ -774,7 +774,7 @@ describe("getSchedule", () => {
|
|||
endTime: `${plus2DateString}T18:29:59.999Z`,
|
||||
timeZone: Timezones["+5:30"],
|
||||
isTeamEvent: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
expect(scheduleForEventOnADayWithDateOverride).toHaveTimeSlots(
|
||||
|
@ -852,7 +852,7 @@ describe("getSchedule", () => {
|
|||
endTime: `${plus2DateString}T18:29:59.999Z`,
|
||||
timeZone: Timezones["+5:30"],
|
||||
isTeamEvent: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
expect(thisUserAvailability).toHaveTimeSlots(
|
||||
|
@ -950,7 +950,7 @@ describe("getSchedule", () => {
|
|||
endTime: `${plus1DateString}T18:29:59.999Z`,
|
||||
timeZone: Timezones["+5:30"],
|
||||
isTeamEvent: true,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
expect(scheduleForTeamEventOnADayWithNoBooking).toHaveTimeSlots(
|
||||
|
@ -980,7 +980,7 @@ describe("getSchedule", () => {
|
|||
endTime: `${plus2DateString}T18:29:59.999Z`,
|
||||
timeZone: Timezones["+5:30"],
|
||||
isTeamEvent: true,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// A user with blocked time in another event, still affects Team Event availability
|
||||
|
@ -1088,7 +1088,7 @@ describe("getSchedule", () => {
|
|||
endTime: `${plus2DateString}T18:29:59.999Z`,
|
||||
timeZone: Timezones["+5:30"],
|
||||
isTeamEvent: true,
|
||||
}
|
||||
},
|
||||
});
|
||||
// A user with blocked time in another event, still affects Team Event availability
|
||||
expect(scheduleForTeamEventOnADayWithOneBookingForEachUserButOnDifferentTimeslots).toHaveTimeSlots(
|
||||
|
@ -1116,7 +1116,7 @@ describe("getSchedule", () => {
|
|||
endTime: `${plus3DateString}T18:29:59.999Z`,
|
||||
timeZone: Timezones["+5:30"],
|
||||
isTeamEvent: true,
|
||||
}
|
||||
},
|
||||
});
|
||||
// A user with blocked time in another event, still affects Team Event availability
|
||||
expect(scheduleForTeamEventOnADayWithOneBookingForEachUserOnSameTimeSlot).toHaveTimeSlots(
|
||||
|
|
|
@ -5,7 +5,7 @@ import { getWorkingHours } from "@calcom/lib/availability";
|
|||
|
||||
beforeAll(() => {
|
||||
vi.setSystemTime(new Date("2021-06-20T11:59:59Z"));
|
||||
})
|
||||
});
|
||||
|
||||
it("correctly translates Availability (UTC+0) to UTC workingHours", async () => {
|
||||
expect(
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import prismaMock from "../../../../tests/libs/__mocks__/prisma";
|
||||
|
||||
import type { EventType } from "@prisma/client";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
|
@ -6,8 +8,6 @@ import { buildEventType } from "@calcom/lib/test/builder";
|
|||
import type { Prisma } from "@calcom/prisma/client";
|
||||
import type { CompleteEventType, CompleteWorkflowsOnEventTypes } from "@calcom/prisma/zod";
|
||||
|
||||
import prismaMock from "../../../../tests/libs/__mocks__/prisma";
|
||||
|
||||
const mockFindFirstEventType = (data?: Partial<CompleteEventType>) => {
|
||||
const eventType = buildEventType(data as Partial<EventType>);
|
||||
prismaMock.eventType.findFirst.mockResolvedValue(eventType as EventType);
|
||||
|
@ -97,11 +97,12 @@ describe("handleChildrenEventTypes", () => {
|
|||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
// eslint-disable-next-line
|
||||
const { schedulingType, id, teamId, timeZone, users,requiresBookerEmailVerification, ...evType } = mockFindFirstEventType({
|
||||
id: 123,
|
||||
metadata: { managedEventConfig: {} },
|
||||
locations: [],
|
||||
});
|
||||
const { schedulingType, id, teamId, timeZone, users, requiresBookerEmailVerification, ...evType } =
|
||||
mockFindFirstEventType({
|
||||
id: 123,
|
||||
metadata: { managedEventConfig: {} },
|
||||
locations: [],
|
||||
});
|
||||
const result = await updateChildrenEventTypes({
|
||||
eventTypeId: 1,
|
||||
oldEventType: { children: [], team: { name: "" } },
|
||||
|
@ -133,11 +134,21 @@ describe("handleChildrenEventTypes", () => {
|
|||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
// eslint-disable-next-line
|
||||
const { schedulingType, id, teamId, timeZone, locations, parentId, userId, scheduleId,requiresBookerEmailVerification, ...evType } =
|
||||
mockFindFirstEventType({
|
||||
metadata: { managedEventConfig: {} },
|
||||
locations: [],
|
||||
});
|
||||
const {
|
||||
schedulingType,
|
||||
id,
|
||||
teamId,
|
||||
timeZone,
|
||||
locations,
|
||||
parentId,
|
||||
userId,
|
||||
scheduleId,
|
||||
requiresBookerEmailVerification,
|
||||
...evType
|
||||
} = mockFindFirstEventType({
|
||||
metadata: { managedEventConfig: {} },
|
||||
locations: [],
|
||||
});
|
||||
const result = await updateChildrenEventTypes({
|
||||
eventTypeId: 1,
|
||||
oldEventType: { children: [{ userId: 4 }], team: { name: "" } },
|
||||
|
@ -218,11 +229,12 @@ describe("handleChildrenEventTypes", () => {
|
|||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
// eslint-disable-next-line
|
||||
const { schedulingType, id, teamId, timeZone, users,requiresBookerEmailVerification, ...evType } = mockFindFirstEventType({
|
||||
id: 123,
|
||||
metadata: { managedEventConfig: {} },
|
||||
locations: [],
|
||||
});
|
||||
const { schedulingType, id, teamId, timeZone, users, requiresBookerEmailVerification, ...evType } =
|
||||
mockFindFirstEventType({
|
||||
id: 123,
|
||||
metadata: { managedEventConfig: {} },
|
||||
locations: [],
|
||||
});
|
||||
prismaMock.eventType.deleteMany.mockResolvedValue([123] as unknown as Prisma.BatchPayload);
|
||||
const result = await updateChildrenEventTypes({
|
||||
eventTypeId: 1,
|
||||
|
@ -255,11 +267,20 @@ describe("handleChildrenEventTypes", () => {
|
|||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
// eslint-disable-next-line
|
||||
const { schedulingType, id, teamId, timeZone, users, locations, parentId, userId,requiresBookerEmailVerification, ...evType } =
|
||||
mockFindFirstEventType({
|
||||
metadata: { managedEventConfig: {} },
|
||||
locations: [],
|
||||
});
|
||||
const {
|
||||
schedulingType,
|
||||
id,
|
||||
teamId,
|
||||
timeZone,
|
||||
locations,
|
||||
parentId,
|
||||
userId,
|
||||
requiresBookerEmailVerification,
|
||||
...evType
|
||||
} = mockFindFirstEventType({
|
||||
metadata: { managedEventConfig: {} },
|
||||
locations: [],
|
||||
});
|
||||
prismaMock.eventType.deleteMany.mockResolvedValue([123] as unknown as Prisma.BatchPayload);
|
||||
const result = await updateChildrenEventTypes({
|
||||
eventTypeId: 1,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { it, expect, describe, beforeAll } from "vitest";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const { getSubdomainRegExp } = require("../../getSubdomainRegExp");
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
|
@ -30,67 +31,50 @@ beforeAll(async () => {
|
|||
|
||||
describe("next.config.js - Org Rewrite", () => {
|
||||
const orgHostRegExp = (subdomainRegExp: string) =>
|
||||
// RegExp copied from pagesAndRewritePaths.js orgHostPath. Do make the change there as well.
|
||||
// RegExp copied from pagesAndRewritePaths.js orgHostPath. Do make the change there as well.
|
||||
new RegExp(`^(?<orgSlug>${subdomainRegExp})\\.(?!vercel\.app).*`);
|
||||
|
||||
describe("Host matching based on NEXT_PUBLIC_WEBAPP_URL", () => {
|
||||
it("https://app.cal.com", () => {
|
||||
const subdomainRegExp = getSubdomainRegExp("https://app.cal.com");
|
||||
expect(orgHostRegExp(subdomainRegExp).exec("app.cal.com")).toEqual(null);
|
||||
expect(
|
||||
orgHostRegExp(subdomainRegExp).exec("company.app.cal.com")?.groups
|
||||
?.orgSlug
|
||||
).toEqual("company");
|
||||
expect(
|
||||
orgHostRegExp(subdomainRegExp).exec("org.cal.com")?.groups?.orgSlug
|
||||
).toEqual("org");
|
||||
expect(orgHostRegExp(subdomainRegExp).exec("company.app.cal.com")?.groups?.orgSlug).toEqual("company");
|
||||
expect(orgHostRegExp(subdomainRegExp).exec("org.cal.com")?.groups?.orgSlug).toEqual("org");
|
||||
|
||||
expect(
|
||||
orgHostRegExp(subdomainRegExp).exec("localhost:3000")
|
||||
).toEqual(null);
|
||||
expect(orgHostRegExp(subdomainRegExp).exec("localhost:3000")).toEqual(null);
|
||||
});
|
||||
|
||||
it("app.cal.com", () => {
|
||||
const subdomainRegExp = getSubdomainRegExp("app.cal.com");
|
||||
expect(orgHostRegExp(subdomainRegExp).exec("app.cal.com")).toEqual(null);
|
||||
expect(
|
||||
orgHostRegExp(subdomainRegExp).exec("company.app.cal.com")?.groups
|
||||
?.orgSlug
|
||||
).toEqual("company");
|
||||
expect(orgHostRegExp(subdomainRegExp).exec("company.app.cal.com")?.groups?.orgSlug).toEqual("company");
|
||||
});
|
||||
|
||||
it("https://calcom.app.company.com", () => {
|
||||
const subdomainRegExp = getSubdomainRegExp(
|
||||
"https://calcom.app.company.com"
|
||||
const subdomainRegExp = getSubdomainRegExp("https://calcom.app.company.com");
|
||||
expect(orgHostRegExp(subdomainRegExp).exec("calcom.app.company.com")).toEqual(null);
|
||||
expect(orgHostRegExp(subdomainRegExp).exec("acme.calcom.app.company.com")?.groups?.orgSlug).toEqual(
|
||||
"acme"
|
||||
);
|
||||
expect(
|
||||
orgHostRegExp(subdomainRegExp).exec("calcom.app.company.com")
|
||||
).toEqual(null);
|
||||
expect(
|
||||
orgHostRegExp(subdomainRegExp).exec("acme.calcom.app.company.com")
|
||||
?.groups?.orgSlug
|
||||
).toEqual("acme");
|
||||
});
|
||||
|
||||
it("https://calcom.example.com", () => {
|
||||
const subdomainRegExp = getSubdomainRegExp("https://calcom.example.com");
|
||||
expect(orgHostRegExp(subdomainRegExp).exec("calcom.example.com")).toEqual(
|
||||
null
|
||||
);
|
||||
expect(
|
||||
orgHostRegExp(subdomainRegExp).exec("acme.calcom.example.com")?.groups
|
||||
?.orgSlug
|
||||
).toEqual("acme");
|
||||
expect(orgHostRegExp(subdomainRegExp).exec("calcom.example.com")).toEqual(null);
|
||||
expect(orgHostRegExp(subdomainRegExp).exec("acme.calcom.example.com")?.groups?.orgSlug).toEqual("acme");
|
||||
// The following also matches which causes anything other than the domain in NEXT_PUBLIC_WEBAPP_URL to give 404
|
||||
expect(
|
||||
orgHostRegExp(subdomainRegExp).exec("some-other.company.com")?.groups
|
||||
?.orgSlug
|
||||
).toEqual("some-other");
|
||||
expect(orgHostRegExp(subdomainRegExp).exec("some-other.company.com")?.groups?.orgSlug).toEqual(
|
||||
"some-other"
|
||||
);
|
||||
});
|
||||
it("Should ignore Vercel preview URLs", () => {
|
||||
const subdomainRegExp = getSubdomainRegExp("https://cal-xxxxxxxx-cal.vercel.app");
|
||||
expect(orgHostRegExp(subdomainRegExp).exec("https://cal-xxxxxxxx-cal.vercel.app")).toMatchInlineSnapshot('null')
|
||||
expect(orgHostRegExp(subdomainRegExp).exec("cal-xxxxxxxx-cal.vercel.app")).toMatchInlineSnapshot('null')
|
||||
expect(
|
||||
orgHostRegExp(subdomainRegExp).exec("https://cal-xxxxxxxx-cal.vercel.app")
|
||||
).toMatchInlineSnapshot("null");
|
||||
expect(orgHostRegExp(subdomainRegExp).exec("cal-xxxxxxxx-cal.vercel.app")).toMatchInlineSnapshot(
|
||||
"null"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { expect, it } from "vitest";
|
||||
|
||||
import prismaMock from "../../../../tests/libs/__mocks__/prisma";
|
||||
|
||||
import { expect, it } from "vitest";
|
||||
|
||||
import { getLuckyUser } from "@calcom/lib/server";
|
||||
import { buildUser } from "@calcom/lib/test/builder";
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
import appStoreMock from "../../../../tests/libs/__mocks__/app-store";
|
||||
import i18nMock from "../../../../tests/libs/__mocks__/libServerI18n";
|
||||
import prismaMock from "../../../../tests/libs/__mocks__/prisma";
|
||||
|
||||
import type {
|
||||
EventType as PrismaEventType,
|
||||
User as PrismaUser,
|
||||
|
@ -17,10 +21,6 @@ import type { BookingStatus } from "@calcom/prisma/enums";
|
|||
import type { EventBusyDate } from "@calcom/types/Calendar";
|
||||
import type { Fixtures } from "@calcom/web/test/fixtures/fixtures";
|
||||
|
||||
import appStoreMock from "../../../../tests/libs/__mocks__/app-store";
|
||||
import i18nMock from "../../../../tests/libs/__mocks__/libServerI18n";
|
||||
import prismaMock from "../../../../tests/libs/__mocks__/prisma";
|
||||
|
||||
type App = {
|
||||
slug: string;
|
||||
dirName: string;
|
||||
|
|
|
@ -8,6 +8,9 @@ module.exports = {
|
|||
printWidth: 110,
|
||||
arrowParens: "always",
|
||||
importOrder: [
|
||||
// Mocks must be at the top as they contain vi.mock calls
|
||||
"(.*)/__mocks__/(.*)",
|
||||
"<THIRD_PARTY_MODULES>",
|
||||
"^@(calcom|ee)/(.*)$",
|
||||
"^@lib/(.*)$",
|
||||
"^@components/(.*)$",
|
||||
|
|
Loading…
Reference in New Issue
Block a user