mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 13:10:42 +00:00
22 lines
781 B
TypeScript
22 lines
781 B
TypeScript
import { describe, expect, test } from "vitest";
|
|
import { getStaticAssetCacheControl } from "../../src/server/StaticAssetCache";
|
|
|
|
describe("StaticAssetCache", () => {
|
|
test("marks Vite asset namespace as immutable", () => {
|
|
expect(getStaticAssetCacheControl("/assets/index-abc123.js")).toBe(
|
|
"public, max-age=31536000, immutable",
|
|
);
|
|
});
|
|
|
|
test("marks custom hashed asset namespace as immutable", () => {
|
|
expect(
|
|
getStaticAssetCacheControl("/_assets/maps/world/manifest.hash.json"),
|
|
).toBe("public, max-age=31536000, immutable");
|
|
});
|
|
|
|
test("does not mark other paths as immutable", () => {
|
|
expect(getStaticAssetCacheControl("/manifest.json")).toBeUndefined();
|
|
expect(getStaticAssetCacheControl("/api/health")).toBeUndefined();
|
|
});
|
|
});
|