import { expect, test } from "bun:test";
import { analyzeRuntimeRequirements, generate, parse } from "../src/index.ts";

test("partial-static pages compile transparent static and streamed dynamic boundaries", () => {
  const ast = parse(
    `page Dashboard { render = "partial-static" view { <Static><header>Docs</header></Static><Dynamic><p>User</p></Dynamic> } }`,
  );
  expect(ast.renderMode).toBe("partial-static");
  expect(analyzeRuntimeRequirements(ast).kind).toBe("streaming-ssr");
  const output = generate(ast);
  expect(output).toContain("wrn-dynamic-region");
  expect(output).toContain("__wrnexusBuildStaticShell");
  expect(output).toContain('<wrn-dynamic-region data-wrn-dynamic="true"></wrn-dynamic-region>');
  expect(output).not.toContain('data-component="Static"');
});
