release: WRNexusJS 0.4.0
This commit is contained in:
@@ -64,3 +64,27 @@ test("streams async body chunks inside the document shell", async () => {
|
||||
).text();
|
||||
expect(html).toContain('<div id="app"><h1>Shell</h1><p>Later</p></div>');
|
||||
});
|
||||
|
||||
test("renders rich script metadata and deduplicates by source", () => {
|
||||
const html = renderDocument({
|
||||
meta: { title: "Runtime" },
|
||||
body: '<main data-wrnexus-runtime="captcha"></main>',
|
||||
scripts: [
|
||||
{
|
||||
src: "/__wrnexus/assets/captcha.abc.js",
|
||||
type: "classic",
|
||||
defer: true,
|
||||
integrity: "sha256-test",
|
||||
crossOrigin: "anonymous",
|
||||
attributes: { "data-wrnexus-runtime-src": "captcha" },
|
||||
},
|
||||
{ src: "/__wrnexus/assets/captcha.abc.js", type: "classic" },
|
||||
],
|
||||
});
|
||||
expect(html.match(/captcha\.abc\.js/g)).toHaveLength(1);
|
||||
expect(html).toContain("defer");
|
||||
expect(html).toContain('integrity="sha256-test"');
|
||||
expect(html).toContain('crossorigin="anonymous"');
|
||||
expect(html).toContain('data-wrnexus-runtime-src="captcha"');
|
||||
expect(html).not.toContain('rel="modulepreload" href="/__wrnexus/assets/captcha.abc.js"');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user