Files
WRNexusJS/packages/dev-server/test/ui-css-hmr.test.ts
2026-07-29 12:51:10 +05:30

24 lines
710 B
TypeScript

import { expect, test } from "bun:test";
import { createDevAssetServer } from "../src/assets.ts";
test("UI CSS is read from its live source after an HMR change", async () => {
let css = ".wire-card { color: red; }";
const assets = createDevAssetServer(
process.cwd(),
"development",
undefined,
undefined,
() => css,
);
const first = await assets.serve("/__wrnexus/ui.css");
expect(await first?.text()).toContain("color: red");
css = ".wire-card { color: blue; }";
assets.invalidateCss();
const second = await assets.serve("/__wrnexus/ui.css");
expect(await second?.text()).toContain("color: blue");
expect(second?.headers.get("cache-control")).toBe("no-cache");
});