chore: bump std to 208 and deal with deprecations (#2081)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
This commit is contained in:
co-authored by
Marvin Hagemeister
parent
6a90fdbf1b
commit
b902205feb
+57
-57
@@ -1,4 +1,4 @@
|
||||
import { ServerContext, Status } from "../server.ts";
|
||||
import { ServerContext, STATUS_CODE } from "../server.ts";
|
||||
import {
|
||||
assert,
|
||||
assertEquals,
|
||||
@@ -28,7 +28,7 @@ const handler = ctx.handler();
|
||||
Deno.test("/ page prerender", async () => {
|
||||
const resp = await handler(new Request("https://fresh.deno.dev/"));
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
assertEquals(resp.headers.get("content-type"), "text/html; charset=utf-8");
|
||||
assertEquals(resp.headers.get("server"), "fresh test server");
|
||||
const body = await resp.text();
|
||||
@@ -55,7 +55,7 @@ Deno.test("/ page prerender", async () => {
|
||||
Deno.test("/props/123 page prerender", async () => {
|
||||
const resp = await handler(new Request("https://fresh.deno.dev/props/123"));
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
assertEquals(resp.headers.get("content-type"), "text/html; charset=utf-8");
|
||||
const body = await resp.text();
|
||||
const doc = parseHtml(body);
|
||||
@@ -72,7 +72,7 @@ Deno.test("/props/123 page prerender", async () => {
|
||||
Deno.test("/greet/[name] page prerender", async () => {
|
||||
const resp = await handler(new Request("https://fresh.deno.dev/bar"));
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
assertEquals(resp.headers.get("content-type"), "text/html; charset=utf-8");
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(body, "<div>Hello bar</div>");
|
||||
@@ -84,7 +84,7 @@ Deno.test("/api/head_override - HEAD", async () => {
|
||||
});
|
||||
const resp = await handler(req);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.NoContent);
|
||||
assertEquals(resp.status, STATUS_CODE.NoContent);
|
||||
assertEquals(resp.body, null);
|
||||
assertEquals(
|
||||
resp.headers.get("content-type"),
|
||||
@@ -98,7 +98,7 @@ Deno.test("/api/get_only - HEAD fallback", async () => {
|
||||
});
|
||||
const resp = await handler(req);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
assertEquals(resp.body, null);
|
||||
assertEquals(
|
||||
resp.headers.get("content-type"),
|
||||
@@ -112,7 +112,7 @@ Deno.test("/intercept - GET html", async () => {
|
||||
});
|
||||
const resp = await handler(req);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(body, "<div>This is HTML</div>");
|
||||
});
|
||||
@@ -123,7 +123,7 @@ Deno.test("/intercept - GET text", async () => {
|
||||
});
|
||||
const resp = await handler(req);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const body = await resp.text();
|
||||
assertEquals(body, "This is plain text");
|
||||
});
|
||||
@@ -134,7 +134,7 @@ Deno.test("/intercept - POST", async () => {
|
||||
});
|
||||
const resp = await handler(req);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const body = await resp.text();
|
||||
assertEquals(body, "POST response");
|
||||
});
|
||||
@@ -145,7 +145,7 @@ Deno.test("/intercept - DELETE", async () => {
|
||||
});
|
||||
const resp = await handler(req);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.MethodNotAllowed);
|
||||
assertEquals(resp.status, STATUS_CODE.MethodNotAllowed);
|
||||
});
|
||||
|
||||
Deno.test("/intercept_args - GET html", async () => {
|
||||
@@ -154,7 +154,7 @@ Deno.test("/intercept_args - GET html", async () => {
|
||||
});
|
||||
const resp = await handler(req);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(body, "<div>intercepted</div>");
|
||||
});
|
||||
@@ -165,7 +165,7 @@ Deno.test("/status_overwrite", async () => {
|
||||
});
|
||||
const resp = await handler(req);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.Unauthorized);
|
||||
assertEquals(resp.status, STATUS_CODE.Unauthorized);
|
||||
assertEquals(resp.headers.get("x-some-header"), "foo");
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(body, "<div>This is HTML</div>");
|
||||
@@ -178,13 +178,13 @@ Deno.test("/api/get_only - NOTAMETHOD", async () => {
|
||||
}),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.MethodNotAllowed);
|
||||
assertEquals(resp.status, STATUS_CODE.MethodNotAllowed);
|
||||
});
|
||||
|
||||
Deno.test("/api/xyz not found", async () => {
|
||||
const resp = await handler(new Request("https://fresh.deno.dev/api/xyz"));
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.NotFound);
|
||||
assertEquals(resp.status, STATUS_CODE.NotFound);
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(body, "404 not found: /api/xyz");
|
||||
});
|
||||
@@ -192,7 +192,7 @@ Deno.test("/api/xyz not found", async () => {
|
||||
Deno.test("/static page prerender", async () => {
|
||||
const resp = await handler(new Request("https://fresh.deno.dev/static"));
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
assertEquals(resp.headers.get("content-type"), "text/html; charset=utf-8");
|
||||
const body = await resp.text();
|
||||
assert(!body.includes(`main.js`));
|
||||
@@ -205,7 +205,7 @@ Deno.test("/static page prerender", async () => {
|
||||
Deno.test("/books/:id page - /books/123", async () => {
|
||||
const resp = await handler(new Request("https://fresh.deno.dev/books/123"));
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
assertEquals(resp.headers.get("content-type"), "text/html; charset=utf-8");
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(body, "<div>Book 123</div>");
|
||||
@@ -214,13 +214,13 @@ Deno.test("/books/:id page - /books/123", async () => {
|
||||
Deno.test("/books/:id page - /books/abc", async () => {
|
||||
const resp = await handler(new Request("https://fresh.deno.dev/books/abc"));
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.NotFound);
|
||||
assertEquals(resp.status, STATUS_CODE.NotFound);
|
||||
});
|
||||
|
||||
Deno.test("/i18n{/:lang}?/lang page - /i18n/lang", async () => {
|
||||
const resp = await handler(new Request("https://fresh.deno.dev/i18n/lang"));
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
assertEquals(resp.headers.get("content-type"), "text/html; charset=utf-8");
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(body, "<div>Hello</div>");
|
||||
@@ -231,7 +231,7 @@ Deno.test("/i18n{/:lang}?/lang page - /i18n/en/lang", async () => {
|
||||
new Request("https://fresh.deno.dev/i18n/en/lang"),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
assertEquals(resp.headers.get("content-type"), "text/html; charset=utf-8");
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(body, "<div>Hello en</div>");
|
||||
@@ -242,7 +242,7 @@ Deno.test("redirect /pages/fresh/ to /pages/fresh", async () => {
|
||||
new Request("https://fresh.deno.dev/pages/fresh/"),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.TemporaryRedirect);
|
||||
assertEquals(resp.status, STATUS_CODE.TemporaryRedirect);
|
||||
assertEquals(
|
||||
resp.headers.get("location"),
|
||||
"/pages/fresh",
|
||||
@@ -254,7 +254,7 @@ Deno.test("redirect /pages/////fresh///// to /pages/////fresh", async () => {
|
||||
new Request("https://fresh.deno.dev/pages/////fresh/////"),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.TemporaryRedirect);
|
||||
assertEquals(resp.status, STATUS_CODE.TemporaryRedirect);
|
||||
assertEquals(
|
||||
resp.headers.get("location"),
|
||||
"/pages/////fresh",
|
||||
@@ -266,7 +266,7 @@ Deno.test("redirect /pages/////fresh/ to /pages/////fresh", async () => {
|
||||
new Request("https://fresh.deno.dev/pages/////fresh/"),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.TemporaryRedirect);
|
||||
assertEquals(resp.status, STATUS_CODE.TemporaryRedirect);
|
||||
assertEquals(
|
||||
resp.headers.get("location"),
|
||||
"/pages/////fresh",
|
||||
@@ -278,13 +278,13 @@ Deno.test("no redirect for /pages/////fresh", async () => {
|
||||
new Request("https://fresh.deno.dev/pages/////fresh"),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.NotFound);
|
||||
assertEquals(resp.status, STATUS_CODE.NotFound);
|
||||
});
|
||||
|
||||
Deno.test("/failure", async () => {
|
||||
const resp = await handler(new Request("https://fresh.deno.dev/failure"));
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.InternalServerError);
|
||||
assertEquals(resp.status, STATUS_CODE.InternalServerError);
|
||||
const body = await resp.text();
|
||||
assert(body.includes("500 internal error: it errored!"));
|
||||
assertStringIncludes(
|
||||
@@ -296,7 +296,7 @@ Deno.test("/failure", async () => {
|
||||
Deno.test("/foo/:path*", async () => {
|
||||
const resp = await handler(new Request("https://fresh.deno.dev/foo/bar/baz"));
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const body = await resp.text();
|
||||
assert(body.includes("bar/baz"));
|
||||
});
|
||||
@@ -319,14 +319,14 @@ Deno.test("static files in custom directory", async () => {
|
||||
const resp = await newRouter(
|
||||
new Request("https://fresh.deno.dev/custom.txt"),
|
||||
);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const body = await resp.text();
|
||||
assert(body.startsWith("dir"));
|
||||
});
|
||||
|
||||
Deno.test("static file - by file path", async () => {
|
||||
const resp = await handler(new Request("https://fresh.deno.dev/foo.txt"));
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const body = await resp.text();
|
||||
assert(body.startsWith("bar"));
|
||||
const etag = resp.headers.get("etag");
|
||||
@@ -334,7 +334,7 @@ Deno.test("static file - by file path", async () => {
|
||||
// The etag is not weak, because this did not go through content encoding, so
|
||||
// this is not a real server.
|
||||
assert(!etag.startsWith("W/"), "etag should be weak");
|
||||
assertEquals(resp.headers.get("content-type"), "text/plain");
|
||||
assertEquals(resp.headers.get("content-type"), "text/plain; charset=UTF-8");
|
||||
|
||||
const resp2 = await handler(
|
||||
new Request("https://fresh.deno.dev/foo.txt", {
|
||||
@@ -343,9 +343,9 @@ Deno.test("static file - by file path", async () => {
|
||||
},
|
||||
}),
|
||||
);
|
||||
assertEquals(resp2.status, Status.NotModified);
|
||||
assertEquals(resp2.status, STATUS_CODE.NotModified);
|
||||
assertEquals(resp2.headers.get("etag"), etag);
|
||||
assertEquals(resp2.headers.get("content-type"), "text/plain");
|
||||
assertEquals(resp2.headers.get("content-type"), "text/plain; charset=UTF-8");
|
||||
|
||||
const resp3 = await handler(
|
||||
new Request("https://fresh.deno.dev/foo.txt", {
|
||||
@@ -354,9 +354,9 @@ Deno.test("static file - by file path", async () => {
|
||||
},
|
||||
}),
|
||||
);
|
||||
assertEquals(resp3.status, Status.NotModified);
|
||||
assertEquals(resp3.status, STATUS_CODE.NotModified);
|
||||
assertEquals(resp3.headers.get("etag"), etag);
|
||||
assertEquals(resp3.headers.get("content-type"), "text/plain");
|
||||
assertEquals(resp3.headers.get("content-type"), "text/plain; charset=UTF-8");
|
||||
});
|
||||
|
||||
Deno.test("static file - spaces or other characters in name", async () => {
|
||||
@@ -376,7 +376,7 @@ Deno.test("HEAD request", async () => {
|
||||
method: "HEAD",
|
||||
}),
|
||||
);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const body = await resp.text();
|
||||
assertEquals(body, "");
|
||||
|
||||
@@ -387,7 +387,7 @@ Deno.test("HEAD request", async () => {
|
||||
}),
|
||||
);
|
||||
assert(resp2);
|
||||
assertEquals(resp2.status, Status.OK);
|
||||
assertEquals(resp2.status, STATUS_CODE.OK);
|
||||
const body2 = await resp2.text();
|
||||
assertEquals(body2, "");
|
||||
});
|
||||
@@ -407,7 +407,7 @@ Deno.test("static file - by 'hashed' path", async () => {
|
||||
new Request(`https://fresh.deno.dev${imgFilePath}`),
|
||||
);
|
||||
const _ = await resp2.text();
|
||||
assertEquals(resp2.status, Status.OK);
|
||||
assertEquals(resp2.status, STATUS_CODE.OK);
|
||||
assertEquals(
|
||||
resp2.headers.get("cache-control"),
|
||||
"public, max-age=31536000, immutable",
|
||||
@@ -420,7 +420,7 @@ Deno.test("static file - by 'hashed' path", async () => {
|
||||
},
|
||||
}),
|
||||
);
|
||||
assertEquals(resp3.status, Status.NotModified);
|
||||
assertEquals(resp3.status, STATUS_CODE.NotModified);
|
||||
|
||||
// ensure asset hook is not applied on file explicitly excluded with attribute
|
||||
const imgFilePathWithNoCache = body.match(
|
||||
@@ -459,7 +459,7 @@ Deno.test("/params/:path*", async () => {
|
||||
new Request("https://fresh.deno.dev/params/bar/baz"),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const body = await resp.text();
|
||||
assertEquals(body, "bar/baz");
|
||||
});
|
||||
@@ -467,7 +467,7 @@ Deno.test("/params/:path*", async () => {
|
||||
Deno.test("/connInfo", async () => {
|
||||
const resp = await handler(new Request("https://fresh.deno.dev/connInfo"));
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const body = await resp.text();
|
||||
assertEquals(body, "localhost");
|
||||
});
|
||||
@@ -477,7 +477,7 @@ Deno.test("state in page props", async () => {
|
||||
new Request("https://fresh.deno.dev/state-in-props"),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
assertEquals(resp.headers.get("content-type"), "text/html; charset=utf-8");
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(
|
||||
@@ -495,7 +495,7 @@ Deno.test({
|
||||
new Request("https://fresh.deno.dev/middleware_root"),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(body, "root_mw");
|
||||
assert(!body.includes("layer1_mw"));
|
||||
@@ -513,7 +513,7 @@ Deno.test({
|
||||
assert(resp);
|
||||
|
||||
// test cors handler
|
||||
assertEquals(resp.status, Status.NoContent);
|
||||
assertEquals(resp.status, STATUS_CODE.NoContent);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -524,7 +524,7 @@ Deno.test({
|
||||
new Request("https://fresh.deno.dev/middleware_root"),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
|
||||
// test log handler
|
||||
const latency = resp.headers.get("latency");
|
||||
@@ -540,7 +540,7 @@ Deno.test({
|
||||
new Request("https://fresh.deno.dev/layeredMdw/layer2/abc"),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(body, "root_mw");
|
||||
assertStringIncludes(body, "layer1_mw");
|
||||
@@ -552,7 +552,7 @@ Deno.test({
|
||||
new Request("https://fresh.deno.dev/layeredMdw/layer2-no-mw/without_mw"),
|
||||
);
|
||||
assert(resp1);
|
||||
assertEquals(resp1.status, Status.OK);
|
||||
assertEquals(resp1.status, STATUS_CODE.OK);
|
||||
const body1 = await resp1.text();
|
||||
assertStringIncludes(body1, "root_mw");
|
||||
assertStringIncludes(body1, "layer1_mw");
|
||||
@@ -569,7 +569,7 @@ Deno.test({
|
||||
new Request("https://fresh.deno.dev/layeredMdw/layer2"),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(body, "root_mw");
|
||||
assertStringIncludes(body, "layer1_mw");
|
||||
@@ -581,7 +581,7 @@ Deno.test({
|
||||
new Request("https://fresh.deno.dev/layeredMdw/layer2-no-mw/without_mw"),
|
||||
);
|
||||
assert(resp1);
|
||||
assertEquals(resp1.status, Status.OK);
|
||||
assertEquals(resp1.status, STATUS_CODE.OK);
|
||||
const body1 = await resp1.text();
|
||||
assertStringIncludes(body1, "root_mw");
|
||||
assertStringIncludes(body1, "layer1_mw");
|
||||
@@ -599,7 +599,7 @@ Deno.test({
|
||||
new Request("https://fresh.deno.dev/layeredMdw/layer2/layer3/abc"),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(body, "root_mw");
|
||||
assertStringIncludes(body, "layer1_mw");
|
||||
@@ -619,7 +619,7 @@ Deno.test({
|
||||
new Request("https://fresh.deno.dev/state-middleware/foo"),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
|
||||
const body = await resp.text();
|
||||
const doc = parseHtml(body);
|
||||
@@ -640,7 +640,7 @@ Deno.test({
|
||||
),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const _body = await resp.text();
|
||||
// assert that outer has access to all params
|
||||
assertEquals(
|
||||
@@ -665,7 +665,7 @@ Deno.test({
|
||||
),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(body, "<div>1234</div>");
|
||||
},
|
||||
@@ -716,7 +716,7 @@ Deno.test({
|
||||
),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.InternalServerError);
|
||||
assertEquals(resp.status, STATUS_CODE.InternalServerError);
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(
|
||||
body,
|
||||
@@ -734,7 +734,7 @@ Deno.test({
|
||||
),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.NotFound);
|
||||
assertEquals(resp.status, STATUS_CODE.NotFound);
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(
|
||||
body,
|
||||
@@ -752,7 +752,7 @@ Deno.test({
|
||||
),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.NotFound);
|
||||
assertEquals(resp.status, STATUS_CODE.NotFound);
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(
|
||||
body,
|
||||
@@ -770,7 +770,7 @@ Deno.test({
|
||||
),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.NotFound);
|
||||
assertEquals(resp.status, STATUS_CODE.NotFound);
|
||||
const body = await resp.text();
|
||||
assertStringIncludes(
|
||||
body,
|
||||
@@ -789,7 +789,7 @@ Deno.test("jsx pragma works", async (t) => {
|
||||
|
||||
await t.step("ssr", async () => {
|
||||
const resp = await fetch(address);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
const text = await resp.text();
|
||||
assertStringIncludes(text, "Hello World");
|
||||
assertStringIncludes(text, "ssr");
|
||||
@@ -877,7 +877,7 @@ Deno.test("PORT environment variable", async () => {
|
||||
const resp = await fetch("http://localhost:" + PORT);
|
||||
await resp.body?.cancel();
|
||||
assert(resp);
|
||||
assertEquals(resp.status, Status.OK);
|
||||
assertEquals(resp.status, STATUS_CODE.OK);
|
||||
await resp.body!.cancel();
|
||||
|
||||
serverProcess.kill("SIGTERM");
|
||||
@@ -907,7 +907,7 @@ Deno.test("rendering custom _500.tsx page for default handlers", async (t) => {
|
||||
await withFakeServe("./tests/fixture_custom_500/main.ts", async (server) => {
|
||||
await t.step("SSR error is shown", async () => {
|
||||
const resp = await server.get("/");
|
||||
assertEquals(resp.status, Status.InternalServerError);
|
||||
assertEquals(resp.status, STATUS_CODE.InternalServerError);
|
||||
const text = await resp.text();
|
||||
assertStringIncludes(text, "Custom 500: Pickle Rick!");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user