diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/unit/fetch_test.ts | 6 | ||||
-rw-r--r-- | cli/tests/unit/io_test.ts | 13 |
2 files changed, 10 insertions, 9 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index fa013f0c5..6ece3c835 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -2,12 +2,12 @@ import { assert, assertEquals, - assertThrows, assertThrowsAsync, fail, unimplemented, unitTest, } from "./test_util.ts"; +import { Buffer } from "../../../test_util/std/io/buffer.ts"; unitTest({ perms: { net: true } }, async function fetchProtocolError(): Promise< void @@ -613,13 +613,13 @@ unitTest({ perms: { net: true } }, async function fetchUserAgent(): Promise< // at Object.assertEquals (file:///C:/deno/js/testing/util.ts:29:11) // at fetchPostBodyString (file -function bufferServer(addr: string): Deno.Buffer { +function bufferServer(addr: string): Buffer { const [hostname, port] = addr.split(":"); const listener = Deno.listen({ hostname, port: Number(port), }) as Deno.Listener; - const buf = new Deno.Buffer(); + const buf = new Buffer(); listener.accept().then(async (conn: Deno.Conn) => { const p1 = buf.readFrom(conn); const p2 = conn.write( diff --git a/cli/tests/unit/io_test.ts b/cli/tests/unit/io_test.ts index ba9641fdc..c5c111e85 100644 --- a/cli/tests/unit/io_test.ts +++ b/cli/tests/unit/io_test.ts @@ -1,5 +1,6 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. import { assertEquals, unitTest } from "./test_util.ts"; +import { Buffer } from "../../../test_util/std/io/buffer.ts"; const DEFAULT_BUF_SIZE = 32 * 1024; @@ -12,7 +13,7 @@ function repeat(c: string, bytes: number): Uint8Array { return ui8; } -function spyRead(obj: Deno.Buffer): Spy { +function spyRead(obj: Buffer): Spy { const spy: Spy = { calls: 0, }; @@ -29,8 +30,8 @@ function spyRead(obj: Deno.Buffer): Spy { unitTest(async function copyWithDefaultBufferSize() { const xBytes = repeat("b", DEFAULT_BUF_SIZE); - const reader = new Deno.Buffer(xBytes.buffer as ArrayBuffer); - const write = new Deno.Buffer(); + const reader = new Buffer(xBytes.buffer as ArrayBuffer); + const write = new Buffer(); const readSpy = spyRead(reader); @@ -44,8 +45,8 @@ unitTest(async function copyWithDefaultBufferSize() { unitTest(async function copyWithCustomBufferSize() { const bufSize = 1024; const xBytes = repeat("b", DEFAULT_BUF_SIZE); - const reader = new Deno.Buffer(xBytes.buffer as ArrayBuffer); - const write = new Deno.Buffer(); + const reader = new Buffer(xBytes.buffer as ArrayBuffer); + const write = new Buffer(); const readSpy = spyRead(reader); @@ -61,7 +62,7 @@ unitTest({ perms: { write: true } }, async function copyBufferToFile() { // bigger than max File possible buffer 16kb const bufSize = 32 * 1024; const xBytes = repeat("b", bufSize); - const reader = new Deno.Buffer(xBytes.buffer as ArrayBuffer); + const reader = new Buffer(xBytes.buffer as ArrayBuffer); const write = await Deno.open(filePath, { write: true, create: true }); const n = await Deno.copy(reader, write, { bufSize }); |