24 lines
710 B
TypeScript
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");
|
|
});
|