22 lines
806 B
TypeScript
22 lines
806 B
TypeScript
import { expect, test } from "bun:test";
|
|
import { precomputePartialStaticShell } from "../src/partial-build.ts";
|
|
|
|
test("precomputes nested page components while erasing dynamic region bodies", async () => {
|
|
const result = await precomputePartialStaticShell(
|
|
{
|
|
__wrnexusBuildStaticShell: () =>
|
|
'<div data-component="Card" title="Docs"></div><wrn-dynamic-region data-wrn-dynamic="true"></wrn-dynamic-region>',
|
|
},
|
|
[
|
|
{
|
|
name: "Card",
|
|
mod: { render: (props) => `<article>${props?.title}</article>` },
|
|
},
|
|
],
|
|
);
|
|
expect(result.regions).toBe(1);
|
|
expect(result.shell).toContain("<article>Docs</article>");
|
|
expect(result.shell).toContain('data-wrn-dynamic-placeholder="wrn-region-0"');
|
|
expect(result.shell).not.toContain("wrn-dynamic-region");
|
|
});
|