import { describe, expect, test, afterEach } from "bun:test";
import { cssHeadTag } from "./ssr-runtime";
const CSS = "styles-abc123.css";
afterEach(() => {
delete process.env.PYLON_SSR_INLINE_CSS;
delete process.env.PYLON_SSR_INLINE_CSS_MAX;
});
describe("cssHeadTag (PYLON_SSR_INLINE_CSS)", () => {
test("default off → plain stylesheet link, untouched", async () => {
const tag = await cssHeadTag(CSS, "/_pylon/build/");
expect(tag).toBe(``);
});
test("enabled but sheet unreadable → falls back to the link", async () => {
process.env.PYLON_SSR_INLINE_CSS = "1";
// No client build exists in the test cwd — the helper must degrade
// to the link, never throw or emit an empty