feat: add context information to render function (#46)
This commit is contained in:
+12
-1
@@ -17,13 +17,24 @@ Deno.test("/ page prerender", async () => {
|
||||
body,
|
||||
`<script id="__FRSH_PROPS" type="application/json">`,
|
||||
);
|
||||
assert(!body.includes(`"params"`));
|
||||
assertStringIncludes(
|
||||
body,
|
||||
`"data":[["home","Hello!"]]`,
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test("/props/123 page prerender", async () => {
|
||||
const resp = await router(new Request("https://fresh.deno.dev/props/123"));
|
||||
assert(resp);
|
||||
assertEquals(resp.status, 200);
|
||||
assertEquals(resp.headers.get("content-type"), "text/html; charset=utf-8");
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(
|
||||
body,
|
||||
`{"props":{"params":{"id":"123"},"url":"https://fresh.deno.dev/props/123","route":"/props/:id"}}`,
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test("/[name] page prerender", async () => {
|
||||
const resp = await router(new Request("https://fresh.deno.dev/foo"));
|
||||
assert(resp);
|
||||
|
||||
Reference in New Issue
Block a user