From e36edfdb3fd4709358a5f499f13cfe3d53c2b4f7 Mon Sep 17 00:00:00 2001 From: Vincent LE GOFF Date: Wed, 6 Mar 2019 22:39:50 +0100 Subject: Testing refactor (denoland/deno_std#240) Original: https://github.com/denoland/deno_std/commit/e1d5c00279132aa639030c6c6d9b4e308bd4775e --- http/server_test.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'http/server_test.ts') 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; } } -- cgit v1.2.3