Fix production dynamic-page modules and trusted email previews
This commit is contained in:
1 parent
bccbf1f4c9
commit
646814d6df
9 files changed
+149
-9
No files matched your search
@@ -38,6 +38,8 @@ export default {
|
||||
join(root, "app", "pages", "index.wrn"),
|
||||
`import RuntimeProbe from "../components/RuntimeProbe.wrn"\npage Home { view { <RuntimeProbe /> } }\n`,
|
||||
);
|
||||
writeFileSync(join(root, "app", "pages", "[id].wrn"),
|
||||
`page Dynamic { functions { client function selectPanel() { console.log('panel-ready') } } view { <button @click="selectPanel()">Panel</button> } }`);
|
||||
|
||||
await runBuild(root);
|
||||
|
||||
@@ -76,6 +78,11 @@ export default {
|
||||
|
||||
const page = await fetch(`http://127.0.0.1:${port}/`);
|
||||
expect(page.status).toBe(200);
|
||||
const dynamic = await fetch(`http://127.0.0.1:${port}/example`);
|
||||
const dynamicHtml = await dynamic.text();
|
||||
const modulePath = dynamicHtml.match(/\/__wrnexus\/client\/[^"\s<>]+\.mjs/)?.[0];
|
||||
expect(modulePath).toMatch(/^\/__wrnexus\/client\/[A-Za-z0-9._-]+\.mjs$/);
|
||||
expect((await fetch(`http://127.0.0.1:${port}${modulePath}`)).status).toBe(200);
|
||||
const html = await page.text();
|
||||
const assetPath = html.match(/(\/__wrnexus\/assets\/runtime-fixture\.[a-f0-9]+\.js)/)?.[1];
|
||||
expect(assetPath).toBeTruthy();
|
||||
|
||||
Reference in new issue
Block a user