summaryrefslogtreecommitdiff
path: root/std/examples/chat
diff options
context:
space:
mode:
Diffstat (limited to 'std/examples/chat')
-rw-r--r--std/examples/chat/server_test.ts9
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");