summaryrefslogtreecommitdiff
path: root/http/server_test.ts
diff options
context:
space:
mode:
authorVincent LE GOFF <g_n_s@hotmail.fr>2019-03-06 22:39:50 +0100
committerRyan Dahl <ry@tinyclouds.org>2019-03-06 16:39:50 -0500
commite36edfdb3fd4709358a5f499f13cfe3d53c2b4f7 (patch)
tree1baef3f876a5e75288c3ec9056cdb93dd6b5787f /http/server_test.ts
parentd29957ad17956016c35a04f5f1f98565e58e8a2e (diff)
Testing refactor (denoland/deno_std#240)
Original: https://github.com/denoland/deno_std/commit/e1d5c00279132aa639030c6c6d9b4e308bd4775e
Diffstat (limited to 'http/server_test.ts')
-rw-r--r--http/server_test.ts21
1 files changed, 11 insertions, 10 deletions
diff --git a/http/server_test.ts b/http/server_test.ts
index cc5863eb5..8bba36127 100644
--- a/http/server_test.ts
+++ b/http/server_test.ts
@@ -6,7 +6,8 @@
// https://github.com/golang/go/blob/master/src/net/http/responsewrite_test.go
const { Buffer } = Deno;
-import { assertEqual, test } from "../testing/mod.ts";
+import { test } from "../testing/mod.ts";
+import { assertEq } from "../testing/asserts.ts";
import { Response, ServerRequest } from "./server.ts";
import { BufReader, BufWriter } from "../io/bufio.ts";
@@ -46,7 +47,7 @@ test(async function responseWrite() {
request.w = bufw;
await request.respond(testCase.response);
- assertEqual(buf.toString(), testCase.raw);
+ assertEq(buf.toString(), testCase.raw);
}
});
@@ -58,7 +59,7 @@ test(async function requestBodyWithContentLength() {
const buf = new Buffer(enc.encode("Hello"));
req.r = new BufReader(buf);
const body = dec.decode(await req.body());
- assertEqual(body, "Hello");
+ assertEq(body, "Hello");
}
// Larger than internal buf
@@ -70,7 +71,7 @@ test(async function requestBodyWithContentLength() {
const buf = new Buffer(enc.encode(longText));
req.r = new BufReader(buf);
const body = dec.decode(await req.body());
- assertEqual(body, longText);
+ assertEq(body, longText);
}
});
@@ -95,7 +96,7 @@ test(async function requestBodyWithTransferEncoding() {
const buf = new Buffer(enc.encode(chunksData));
req.r = new BufReader(buf);
const body = dec.decode(await req.body());
- assertEqual(body, shortText);
+ assertEq(body, shortText);
}
// Larger than internal buf
@@ -119,7 +120,7 @@ test(async function requestBodyWithTransferEncoding() {
const buf = new Buffer(enc.encode(chunksData));
req.r = new BufReader(buf);
const body = dec.decode(await req.body());
- assertEqual(body, longText);
+ assertEq(body, longText);
}
});
@@ -135,7 +136,7 @@ test(async function requestBodyStreamWithContentLength() {
let offset = 0;
for await (const chunk of it) {
const s = dec.decode(chunk);
- assertEqual(shortText.substr(offset, s.length), s);
+ assertEq(shortText.substr(offset, s.length), s);
offset += s.length;
}
}
@@ -152,7 +153,7 @@ test(async function requestBodyStreamWithContentLength() {
let offset = 0;
for await (const chunk of it) {
const s = dec.decode(chunk);
- assertEqual(longText.substr(offset, s.length), s);
+ assertEq(longText.substr(offset, s.length), s);
offset += s.length;
}
}
@@ -182,7 +183,7 @@ test(async function requestBodyStreamWithTransferEncoding() {
let offset = 0;
for await (const chunk of it) {
const s = dec.decode(chunk);
- assertEqual(shortText.substr(offset, s.length), s);
+ assertEq(shortText.substr(offset, s.length), s);
offset += s.length;
}
}
@@ -211,7 +212,7 @@ test(async function requestBodyStreamWithTransferEncoding() {
let offset = 0;
for await (const chunk of it) {
const s = dec.decode(chunk);
- assertEqual(longText.substr(offset, s.length), s);
+ assertEq(longText.substr(offset, s.length), s);
offset += s.length;
}
}