summaryrefslogtreecommitdiff
path: root/http/racing_server_test.ts
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2019-05-23 19:04:06 -0700
committerBert Belder <bertbelder@gmail.com>2019-05-29 09:50:12 -0700
commitb95f79d74cbcf3492abd95d4c90839e32f51399f (patch)
treed0c68f01c798da1e3b81930cfa58a5370c56775f /http/racing_server_test.ts
parent5b37b560fb047e1df6e6f68fcbaece922637a93c (diff)
io: refactor BufReader/Writer interfaces to be more idiomatic (denoland/deno_std#444)
Thanks Vincent Le Goff (@zekth) for porting over the CSV reader implementation. Fixes: denoland/deno_std#436 Original: https://github.com/denoland/deno_std/commit/0ee6334b698072b50c6f5ac8d42d34dc4c94b948
Diffstat (limited to 'http/racing_server_test.ts')
-rw-r--r--http/racing_server_test.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/http/racing_server_test.ts b/http/racing_server_test.ts
index cdcdca1a7..f98072c16 100644
--- a/http/racing_server_test.ts
+++ b/http/racing_server_test.ts
@@ -1,8 +1,8 @@
const { dial, run } = Deno;
-import { test } from "../testing/mod.ts";
+import { test, runIfMain } from "../testing/mod.ts";
import { assert, assertEquals } from "../testing/asserts.ts";
-import { BufReader } from "../io/bufio.ts";
+import { BufReader, EOF } from "../io/bufio.ts";
import { TextProtoReader } from "../textproto/mod.ts";
let server;
@@ -13,9 +13,8 @@ async function startServer(): Promise<void> {
});
// Once fileServer is ready it will write to its stdout.
const r = new TextProtoReader(new BufReader(server.stdout));
- const [s, err] = await r.readLine();
- assert(err == null);
- assert(s.includes("Racing server listening..."));
+ const s = await r.readLine();
+ assert(s !== EOF && s.includes("Racing server listening..."));
}
function killServer(): void {
server.close();
@@ -57,9 +56,10 @@ test(async function serverPipelineRace(): Promise<void> {
const outLines = output.split("\n");
// length - 1 to disregard last empty line
for (let i = 0; i < outLines.length - 1; i++) {
- const [s, err] = await r.readLine();
- assert(!err);
+ const s = await r.readLine();
assertEquals(s, outLines[i]);
}
killServer();
});
+
+runIfMain(import.meta);