Files
WRNexusJS/packages/dev-server/test/partial-build.test.ts
Clintchiz 586a6db8ff
Quality / quality (ubuntu-latest) (push) Failing after 21s
Quality / quality (windows-latest) (push) Canceled after 0s
release: WRNexusJS 0.8.0
2026-08-02 23:18:51 +05:30

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");
});