Open History to see the last commit
1import { describe, expect, it } from "vite-plus/test";
2
3import { isProjectFaviconFallbackUrl, PROJECT_FAVICON_FALLBACK_MARKER } from "./projectFavicon.ts";
4
5describe("project favicon", () => {
6 it("identifies fallback asset URLs by their dedicated filename", () => {
7 expect(
8 isProjectFaviconFallbackUrl(
9 `https://environment.example/api/assets/signed-token/${PROJECT_FAVICON_FALLBACK_MARKER}`,
10 ),
11 ).toBe(true);
12 expect(
13 isProjectFaviconFallbackUrl(`/api/assets/signed-token/${PROJECT_FAVICON_FALLBACK_MARKER}`),
14 ).toBe(true);
15 });
16
17 it("does not mistake real favicons or query parameters for fallbacks", () => {
18 expect(
19 isProjectFaviconFallbackUrl("https://environment.example/api/assets/token/favicon.svg"),
20 ).toBe(false);
21 expect(
22 isProjectFaviconFallbackUrl(
23 `https://environment.example/api/assets/token/favicon.svg?name=${PROJECT_FAVICON_FALLBACK_MARKER}`,
24 ),
25 ).toBe(false);
26 expect(isProjectFaviconFallbackUrl(null)).toBe(false);
27 });
28});