diff options
author | uki00a <uki00a@gmail.com> | 2020-02-24 22:31:40 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-24 08:31:40 -0500 |
commit | fe9ac35a650dfeea9168fc1cbbbf323b5689fc3b (patch) | |
tree | 56008d06659dbc0cc167eb0380006dbc5b3d48f4 /std/examples/chat/server_test.ts | |
parent | 162d66d23fe984d7ac0396faacb8800f19a719fd (diff) |
fix(std/examples): add tests for examples (#4094)
Diffstat (limited to 'std/examples/chat/server_test.ts')
-rw-r--r-- | std/examples/chat/server_test.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/std/examples/chat/server_test.ts b/std/examples/chat/server_test.ts index d43e41693..0b44e5bce 100644 --- a/std/examples/chat/server_test.ts +++ b/std/examples/chat/server_test.ts @@ -1,3 +1,4 @@ +// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import { assert, assertEquals } from "../../testing/asserts.ts"; import { TextProtoReader } from "../../textproto/mod.ts"; import { BufReader } from "../../io/bufio.ts"; @@ -22,10 +23,12 @@ async function startServer(): Promise<void> { const { test } = Deno; -await startServer(); +test("beforeAll", async () => { + await startServer(); +}); test("GET / should serve html", async () => { - const resp = await fetch("http://0.0.0.0:8080/"); + const resp = await fetch("http://127.0.0.1:8080/"); assertEquals(resp.status, 200); assertEquals(resp.headers.get("content-type"), "text/html"); const html = await resp.body.text(); @@ -34,7 +37,7 @@ test("GET / should serve html", async () => { let ws: WebSocket | undefined; test("GET /ws should upgrade conn to ws", async () => { - ws = await connectWebSocket("http://0.0.0.0:8080/ws"); + ws = await connectWebSocket("http://127.0.0.1:8080/ws"); const it = ws.receive(); assertEquals((await it.next()).value, "Connected: [1]"); ws.send("Hello"); |