import { expect, test } from "bun:test";
import { partialPrerender, streamPartialDocument } from "../src/index.ts";
test("partial prerender extracts and streams dynamic regions after the shell", async () => {
const result = partialPrerender(
'User',
);
expect(result.shell).toContain("data-wrn-dynamic-placeholder");
expect(result.regions).toEqual([{ id: "wrn-region-0", html: "User" }]);
const output = await new Response(streamPartialDocument(result)).text();
expect(output.indexOf("")).toBeLessThan(output.indexOf("User"));
});