diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-03-24 17:24:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-24 12:24:58 -0400 |
commit | 30bcf6a2ea620aa989a7362e7f4a62fc11743bb4 (patch) | |
tree | a1e0721425a34c40142230fe392cac15170a6791 /std/examples/chat/server_test.ts | |
parent | b2478f3a217d5decbb638bf46e169ee58f17adad (diff) |
Revert "avoid using same port number for test (#4147)"
Ref #4467
This reverts commit 60cee4f045778777a16b6fffd6d5b9a1400d7246.
Diffstat (limited to 'std/examples/chat/server_test.ts')
-rw-r--r-- | std/examples/chat/server_test.ts | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/std/examples/chat/server_test.ts b/std/examples/chat/server_test.ts index e09771e52..13a5c337c 100644 --- a/std/examples/chat/server_test.ts +++ b/std/examples/chat/server_test.ts @@ -3,22 +3,13 @@ import { assert, assertEquals } from "../../testing/asserts.ts"; import { TextProtoReader } from "../../textproto/mod.ts"; import { BufReader } from "../../io/bufio.ts"; import { connectWebSocket, WebSocket } from "../../ws/mod.ts"; -import { randomPort } from "../../http/test_util.ts"; import { delay } from "../../util/async.ts"; -const port = randomPort(); - const { test, build } = Deno; async function startServer(): Promise<Deno.Process> { const server = Deno.run({ - cmd: [ - Deno.execPath(), - "--allow-net", - "--allow-read", - "server.ts", - `127.0.0.1:${port}` - ], + cmd: [Deno.execPath(), "--allow-net", "--allow-read", "server.ts"], cwd: "examples/chat", stdout: "piped" }); @@ -44,7 +35,7 @@ test({ async fn() { const server = await startServer(); try { - const resp = await fetch(`http://127.0.0.1:${port}/`); + 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(); @@ -64,7 +55,7 @@ test({ const server = await startServer(); let ws: WebSocket | undefined; try { - ws = await connectWebSocket(`http://127.0.0.1:${port}/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"); |