diff options
author | Nayeem Rahman <muhammed.9939@gmail.com> | 2020-03-15 12:03:25 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-15 13:03:25 +0100 |
commit | 6471d4cfabf27c0f5e7b340568aa88712d270541 (patch) | |
tree | 29ca29b6baeb4715a0b7eeb24aeaf8b0ed112e97 /std/examples/chat/server_test.ts | |
parent | 2f4be6e9441c7d5b0afd0d37dccd48d3057bcd3f (diff) |
refactor(std): Uncomment disabled tests, use skip option (#4378)
Diffstat (limited to 'std/examples/chat/server_test.ts')
-rw-r--r-- | std/examples/chat/server_test.ts | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/std/examples/chat/server_test.ts b/std/examples/chat/server_test.ts index 3e2a62ee0..c63453a19 100644 --- a/std/examples/chat/server_test.ts +++ b/std/examples/chat/server_test.ts @@ -24,29 +24,47 @@ async function startServer(): Promise<void> { const { test, build } = Deno; // TODO: https://github.com/denoland/deno/issues/4108 -if (build.os !== "win") { - test("beforeAll", async () => { +const skip = build.os == "win"; + +test({ + skip, + name: "beforeAll", + async fn() { await startServer(); - }); + } +}); - test("GET / should serve html", async () => { +test({ + skip, + name: "GET / should serve html", + async fn() { 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(); assert(html.includes("ws chat example"), "body is ok"); - }); + } +}); + +let ws: WebSocket | undefined; - let ws: WebSocket | undefined; - test("GET /ws should upgrade conn to ws", async () => { +test({ + skip, + name: "GET /ws should upgrade conn to ws", + async fn() { ws = await connectWebSocket("http://127.0.0.1:8080/ws"); const it = ws.receive(); assertEquals((await it.next()).value, "Connected: [1]"); ws.send("Hello"); assertEquals((await it.next()).value, "[1]: Hello"); - }); - test("afterAll", () => { + } +}); + +test({ + skip, + name: "afterAll", + fn() { server?.close(); ws?.conn.close(); - }); -} + } +}); |