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

brand-assets.test.ts

56 lines2.1 KB

1import { describe, expect, it } from "vite-plus/test";
2​
3import {
4 BRAND_ASSET_PATHS,
5 resolveWebAssetBrandForChannel,
6 resolveWebAssetBrandForPackageVersion,
7 resolveWebIconOverrides,
8} from "./brand-assets.ts";
9​
10describe("brand-assets", () => {
11 it("maps production web assets into the server package", () => {
12 expect(resolveWebIconOverrides("production", "dist/client")).toEqual([
13 {
14 sourceRelativePath: BRAND_ASSET_PATHS.productionWebFaviconIco,
15 targetRelativePath: "dist/client/favicon.ico",
16 },
17 {
18 sourceRelativePath: BRAND_ASSET_PATHS.productionWebFavicon16Png,
19 targetRelativePath: "dist/client/favicon-16x16.png",
20 },
21 {
22 sourceRelativePath: BRAND_ASSET_PATHS.productionWebFavicon32Png,
23 targetRelativePath: "dist/client/favicon-32x32.png",
24 },
25 {
26 sourceRelativePath: BRAND_ASSET_PATHS.productionWebAppleTouchIconPng,
27 targetRelativePath: "dist/client/apple-touch-icon.png",
28 },
29 ]);
30 });
31​
32 it("can target hosted web dist directly", () => {
33 expect(resolveWebIconOverrides("production", "apps/web/dist")).toContainEqual({
34 sourceRelativePath: BRAND_ASSET_PATHS.productionWebAppleTouchIconPng,
35 targetRelativePath: "apps/web/dist/apple-touch-icon.png",
36 });
37 });
38​
39 it("maps hosted nightly web assets to nightly icons", () => {
40 expect(resolveWebIconOverrides("nightly", "apps/web/dist")).toContainEqual({
41 sourceRelativePath: BRAND_ASSET_PATHS.nightlyWebFaviconIco,
42 targetRelativePath: "apps/web/dist/favicon.ico",
43 });
44 });
45​
46 it("maps hosted release channels to web asset brands", () => {
47 expect(resolveWebAssetBrandForChannel("latest")).toBe("production");
48 expect(resolveWebAssetBrandForChannel("nightly")).toBe("nightly");
49 });
50​
51 it("maps package versions to web asset brands", () => {
52 expect(resolveWebAssetBrandForPackageVersion("0.0.29")).toBe("production");
53 expect(resolveWebAssetBrandForPackageVersion("0.0.29-nightly.20260723.882")).toBe("nightly");
54 expect(resolveWebAssetBrandForPackageVersion("0.0.29-preview.20260723.882")).toBe("nightly");
55 });
56});