first commit
This commit is contained in:
30
calcom/packages/lib/getBookerUrl/client.test.ts
Normal file
30
calcom/packages/lib/getBookerUrl/client.test.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
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");
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user