2
0
Files
cal/calcom/packages/lib/getBookerUrl/client.test.ts
2024-08-09 00:39:27 +02:00

31 lines
1.1 KiB
TypeScript

import { describe, it, vi, expect } from "vitest";
import { getTeamUrlSync } from "./client";
import * as getBookerBaseUrlSyncExport from "./getBookerBaseUrlSync";
vi.mock("./getBookerBaseUrlSync", async () => {
return {
getBookerBaseUrlSync: vi.fn(),
};
});
describe("getBookerUrl:client", () => {
describe("getTeamUrlSync", () => {
it("if orgSlug is null, it should return a URL with /team in it", () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
getBookerBaseUrlSyncExport.getBookerBaseUrlSync.mockReturnValueOnce("https://abc.com");
const url = getTeamUrlSync({ orgSlug: null, teamSlug: "myTeam" });
expect(url).toBe("https://abc.com/team/myTeam");
});
it("if orgSlug is set, it should return a URL without /team in it", () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
getBookerBaseUrlSyncExport.getBookerBaseUrlSync.mockReturnValueOnce("https://acme.com");
const url = getTeamUrlSync({ orgSlug: "acme", teamSlug: "myTeam" });
expect(url).toBe("https://acme.com/myTeam");
});
});
});