-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
superdeno.std.test.ts
38 lines (32 loc) · 906 Bytes
/
superdeno.std.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { Server } from "../deps.ts";
import { describe, it } from "./utils.ts";
import { superdeno } from "../mod.ts";
describe("std: superdeno", () => {
it("std: superdeno(server): should support `superdeno(server)`", async () => {
const server = new Server({
port: 0,
handler() {
return new Response("hello");
},
});
await superdeno(server)
.get("/")
.expect("hello");
});
it("std: superdeno(url): should support `superdeno(url)`", async () => {
const server = new Server({
port: 0,
handler() {
return new Response("hello");
},
});
const serverPromise = server.listenAndServe();
const address = server.addrs[0] as Deno.NetAddr;
const url = `http://127.0.0.1:${address.port}`;
await superdeno(url)
.get("/")
.expect("hello");
server.close();
await serverPromise;
});
});