summaryrefslogtreecommitdiff
path: root/cli/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit')
-rw-r--r--cli/tests/unit/files_test.ts2
-rw-r--r--cli/tests/unit/flash_test.ts8
-rw-r--r--cli/tests/unit/http_test.ts10
-rw-r--r--cli/tests/unit/read_file_test.ts14
-rw-r--r--cli/tests/unit/read_text_file_test.ts14
-rw-r--r--cli/tests/unit/test_util.ts2
-rw-r--r--cli/tests/unit/tls_test.ts10
7 files changed, 26 insertions, 34 deletions
diff --git a/cli/tests/unit/files_test.ts b/cli/tests/unit/files_test.ts
index bb095072c..e5d3a96a7 100644
--- a/cli/tests/unit/files_test.ts
+++ b/cli/tests/unit/files_test.ts
@@ -8,7 +8,7 @@ import {
assertRejects,
assertThrows,
} from "./test_util.ts";
-import { copy } from "../../../test_util/std/io/util.ts";
+import { copy } from "../../../test_util/std/streams/conversion.ts";
Deno.test(function filesStdioFileDescriptors() {
assertEquals(Deno.stdin.rid, 0);
diff --git a/cli/tests/unit/flash_test.ts b/cli/tests/unit/flash_test.ts
index a5a31a136..375fdb8f3 100644
--- a/cli/tests/unit/flash_test.ts
+++ b/cli/tests/unit/flash_test.ts
@@ -7,7 +7,7 @@ import {
BufReader,
BufWriter,
} from "../../../test_util/std/io/buffer.ts";
-import { TextProtoReader } from "../../../test_util/std/textproto/mod.ts";
+import { TextProtoReader } from "../testdata/run/textproto.ts";
import {
assert,
assertEquals,
@@ -763,7 +763,7 @@ Deno.test(
const tpr = new TextProtoReader(r);
const statusLine = await tpr.readLine();
assert(statusLine !== null);
- const headers = await tpr.readMIMEHeader();
+ const headers = await tpr.readMimeHeader();
assert(headers !== null);
const chunkedReader = chunkedBodyReader(headers, r);
@@ -920,7 +920,7 @@ Deno.test(
assert(m !== null, "must be matched");
const [_, _proto, status, _ok] = m;
assertEquals(status, "200");
- const headers = await tpr.readMIMEHeader();
+ const headers = await tpr.readMimeHeader();
assert(headers !== null);
}
@@ -2342,7 +2342,7 @@ async function readTrailers(
if (trailers == null) return;
const trailerNames = [...trailers.keys()];
const tp = new TextProtoReader(r);
- const result = await tp.readMIMEHeader();
+ const result = await tp.readMimeHeader();
if (result == null) {
throw new Deno.errors.InvalidData("Missing trailer header.");
}
diff --git a/cli/tests/unit/http_test.ts b/cli/tests/unit/http_test.ts
index 7bb16aecc..63eae3ace 100644
--- a/cli/tests/unit/http_test.ts
+++ b/cli/tests/unit/http_test.ts
@@ -4,7 +4,7 @@ import {
BufReader,
BufWriter,
} from "../../../test_util/std/io/buffer.ts";
-import { TextProtoReader } from "../../../test_util/std/textproto/mod.ts";
+import { TextProtoReader } from "../testdata/run/textproto.ts";
import { serve, serveTls } from "../../../test_util/std/http/server.ts";
import {
assert,
@@ -30,7 +30,7 @@ async function writeRequestAndReadResponse(conn: Deno.Conn): Promise<string> {
const tpr = new TextProtoReader(r);
const statusLine = await tpr.readLine();
assert(statusLine !== null);
- const headers = await tpr.readMIMEHeader();
+ const headers = await tpr.readMimeHeader();
assert(headers !== null);
const chunkedReader = chunkedBodyReader(headers, r);
@@ -605,7 +605,7 @@ Deno.test(
const tpr = new TextProtoReader(r);
const statusLine = await tpr.readLine();
assert(statusLine !== null);
- const headers = await tpr.readMIMEHeader();
+ const headers = await tpr.readMimeHeader();
assert(headers !== null);
const chunkedReader = chunkedBodyReader(headers, r);
@@ -751,7 +751,7 @@ Deno.test(
assert(m !== null, "must be matched");
const [_, _proto, status, _ok] = m;
assertEquals(status, "200");
- const headers = await tpr.readMIMEHeader();
+ const headers = await tpr.readMimeHeader();
assert(headers !== null);
}
@@ -2459,7 +2459,7 @@ async function readTrailers(
if (trailers == null) return;
const trailerNames = [...trailers.keys()];
const tp = new TextProtoReader(r);
- const result = await tp.readMIMEHeader();
+ const result = await tp.readMimeHeader();
if (result == null) {
throw new Deno.errors.InvalidData("Missing trailer header.");
}
diff --git a/cli/tests/unit/read_file_test.ts b/cli/tests/unit/read_file_test.ts
index c18cdf059..888021eda 100644
--- a/cli/tests/unit/read_file_test.ts
+++ b/cli/tests/unit/read_file_test.ts
@@ -95,17 +95,15 @@ Deno.test(
async function readFileWithAbortSignal() {
const ac = new AbortController();
queueMicrotask(() => ac.abort());
- await assertRejects(
+ const error = await assertRejects(
async () => {
await Deno.readFile("cli/tests/testdata/assets/fixture.json", {
signal: ac.signal,
});
},
- (error: Error) => {
- assert(error instanceof DOMException);
- assertEquals(error.name, "AbortError");
- },
);
+ assert(error instanceof DOMException);
+ assertEquals(error.name, "AbortError");
},
);
@@ -115,16 +113,14 @@ Deno.test(
const ac = new AbortController();
const abortReason = new Error();
queueMicrotask(() => ac.abort(abortReason));
- await assertRejects(
+ const error = await assertRejects(
async () => {
await Deno.readFile("cli/tests/testdata/assets/fixture.json", {
signal: ac.signal,
});
},
- (error: Error) => {
- assertEquals(error, abortReason);
- },
);
+ assertEquals(error, abortReason);
},
);
diff --git a/cli/tests/unit/read_text_file_test.ts b/cli/tests/unit/read_text_file_test.ts
index 119c650b6..5e455c583 100644
--- a/cli/tests/unit/read_text_file_test.ts
+++ b/cli/tests/unit/read_text_file_test.ts
@@ -91,17 +91,15 @@ Deno.test(
async function readTextFileWithAbortSignal() {
const ac = new AbortController();
queueMicrotask(() => ac.abort());
- await assertRejects(
+ const error = await assertRejects(
async () => {
await Deno.readFile("cli/tests/testdata/assets/fixture.json", {
signal: ac.signal,
});
},
- (error: Error) => {
- assert(error instanceof DOMException);
- assertEquals(error.name, "AbortError");
- },
);
+ assert(error instanceof DOMException);
+ assertEquals(error.name, "AbortError");
},
);
@@ -111,16 +109,14 @@ Deno.test(
const ac = new AbortController();
const abortReason = new Error();
queueMicrotask(() => ac.abort(abortReason));
- await assertRejects(
+ const error = await assertRejects(
async () => {
await Deno.readFile("cli/tests/testdata/assets/fixture.json", {
signal: ac.signal,
});
},
- (error: Error) => {
- assertEquals(error, abortReason);
- },
);
+ assertEquals(error, abortReason);
},
);
diff --git a/cli/tests/unit/test_util.ts b/cli/tests/unit/test_util.ts
index 19cad092d..c33da5338 100644
--- a/cli/tests/unit/test_util.ts
+++ b/cli/tests/unit/test_util.ts
@@ -20,7 +20,7 @@ export {
export { deferred } from "../../../test_util/std/async/deferred.ts";
export type { Deferred } from "../../../test_util/std/async/deferred.ts";
export { delay } from "../../../test_util/std/async/delay.ts";
-export { readLines } from "../../../test_util/std/io/bufio.ts";
+export { readLines } from "../../../test_util/std/io/buffer.ts";
export { parse as parseArgs } from "../../../test_util/std/flags/mod.ts";
export function pathToAbsoluteFileUrl(path: string): URL {
diff --git a/cli/tests/unit/tls_test.ts b/cli/tests/unit/tls_test.ts
index a5b87239a..cf335de49 100644
--- a/cli/tests/unit/tls_test.ts
+++ b/cli/tests/unit/tls_test.ts
@@ -9,9 +9,9 @@ import {
Deferred,
deferred,
} from "./test_util.ts";
-import { BufReader, BufWriter } from "../../../test_util/std/io/bufio.ts";
-import { readAll } from "../../../test_util/std/io/util.ts";
-import { TextProtoReader } from "../../../test_util/std/textproto/mod.ts";
+import { BufReader, BufWriter } from "../../../test_util/std/io/buffer.ts";
+import { readAll } from "../../../test_util/std/streams/conversion.ts";
+import { TextProtoReader } from "../testdata/run/textproto.ts";
const encoder = new TextEncoder();
const decoder = new TextDecoder();
@@ -195,7 +195,7 @@ Deno.test(
assertEquals(proto, "HTTP/1.1");
assertEquals(status, "200");
assertEquals(ok, "OK");
- const headers = await tpr.readMIMEHeader();
+ const headers = await tpr.readMimeHeader();
assert(headers !== null);
const contentLength = parseInt(headers.get("content-length")!);
const bodyBuf = new Uint8Array(contentLength);
@@ -248,7 +248,7 @@ Deno.test(
assertEquals(proto, "HTTP/1.1");
assertEquals(status, "200");
assertEquals(ok, "OK");
- const headers = await tpr.readMIMEHeader();
+ const headers = await tpr.readMimeHeader();
assert(headers !== null);
const contentLength = parseInt(headers.get("content-length")!);
const bodyBuf = new Uint8Array(contentLength);