-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2bc34f
commit c6809a0
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { createHandler } from "$fresh/server.ts" | ||
import manifest from "@/fresh.gen.ts" | ||
import { assert, assertEquals } from "$std/testing/asserts.ts" | ||
import { Status } from "$std/http/http_status.ts" | ||
|
||
const CONN_INFO = { | ||
localAddr: { hostname: "127.0.0.1", port: 8000, transport: "tcp" }, | ||
remoteAddr: { hostname: "127.0.0.1", port: 53496, transport: "tcp" }, | ||
} | ||
|
||
// globalThis.document = new DOMParser().parseFromString( | ||
// "<html></html>", // this the main change | ||
// "text/html", | ||
// ) | ||
// window.document = globalThis.document | ||
|
||
Deno.test("HTTP assert test.", async (t) => { | ||
const handler = await createHandler(manifest) | ||
|
||
await t.step("#1 GET /", async () => { | ||
const resp = await handler(new Request("http://127.0.0.1/"), CONN_INFO) | ||
assertEquals(resp.status, Status.OK) | ||
}) | ||
|
||
// await t.step("#3 GET /showcase", async () => { | ||
// const resp = await handler( | ||
// new Request("http://127.0.0.1/showcase"), | ||
// CONN_INFO, | ||
// ) | ||
// const text = await resp.text() | ||
// assert(text.includes("<div>Hello Foo!</div>")) | ||
// }) | ||
}) |