fix: render state not unique per render (#1638)

This commit is contained in:
Marvin Hagemeister
2023-08-16 16:30:16 +02:00
committed by GitHub
parent b2362da281
commit f67ec8520f
11 changed files with 840 additions and 646 deletions
+9 -4
View File
@@ -58,10 +58,15 @@ Deno.test("/props/123 page prerender", async () => {
assertEquals(resp.status, Status.OK);
assertEquals(resp.headers.get("content-type"), "text/html; charset=utf-8");
const body = await resp.text();
assertStringIncludes(
body,
`{"params":{"id":"123"},"url":"https://fresh.deno.dev/props/123","route":"/props/:id","state":{"root":"root_mw"}}`,
);
const doc = parseHtml(body);
const data = JSON.parse(doc.querySelector("body > div").textContent);
assertEquals(data, {
"params": { "id": "123" },
"url": "https://fresh.deno.dev/props/123",
"route": "/props/:id",
"state": { "root": "root_mw" },
});
});
Deno.test("/greet/[name] page prerender", async () => {