29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import { describe, expect, it } from "vite-plus/test";
|
|
|
|
import { isProjectFaviconFallbackUrl, PROJECT_FAVICON_FALLBACK_MARKER } from "./projectFavicon.ts";
|
|
|
|
describe("project favicon", () => {
|
|
it("identifies fallback asset URLs by their dedicated filename", () => {
|
|
expect(
|
|
isProjectFaviconFallbackUrl(
|
|
`https://environment.example/api/assets/signed-token/${PROJECT_FAVICON_FALLBACK_MARKER}`,
|
|
),
|
|
).toBe(true);
|
|
expect(
|
|
isProjectFaviconFallbackUrl(`/api/assets/signed-token/${PROJECT_FAVICON_FALLBACK_MARKER}`),
|
|
).toBe(true);
|
|
});
|
|
|
|
it("does not mistake real favicons or query parameters for fallbacks", () => {
|
|
expect(
|
|
isProjectFaviconFallbackUrl("https://environment.example/api/assets/token/favicon.svg"),
|
|
).toBe(false);
|
|
expect(
|
|
isProjectFaviconFallbackUrl(
|
|
`https://environment.example/api/assets/token/favicon.svg?name=${PROJECT_FAVICON_FALLBACK_MARKER}`,
|
|
),
|
|
).toBe(false);
|
|
expect(isProjectFaviconFallbackUrl(null)).toBe(false);
|
|
});
|
|
});
|