Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

branding.test.ts

37 lines930 Bytes

1import { afterEach, describe, expect, it, vi } from "vitest";
2​
3const originalWindow = globalThis.window;
4​
5afterEach(() => {
6 vi.resetModules();
7​
8 if (originalWindow === undefined) {
9 Reflect.deleteProperty(globalThis, "window");
10 return;
11 }
12​
13 globalThis.window = originalWindow;
14});
15​
16describe("branding", () => {
17 it("uses injected desktop branding when available", async () => {
18 Object.defineProperty(globalThis, "window", {
19 configurable: true,
20 value: {
21 desktopBridge: {
22 getAppBranding: () => ({
23 baseName: "T3 Code",
24 stageLabel: "Nightly",
25 displayName: "T3 Code (Nightly)",
26 }),
27 },
28 },
29 });
30​
31 const branding = await import("./branding");
32​
33 expect(branding.APP_BASE_NAME).toBe("T3 Code");
34 expect(branding.APP_STAGE_LABEL).toBe("Nightly");
35 expect(branding.APP_DISPLAY_NAME).toBe("T3 Code (Nightly)");
36 });
37});