summaryrefslogtreecommitdiff
path: root/std/examples/tests
diff options
context:
space:
mode:
Diffstat (limited to 'std/examples/tests')
-rw-r--r--std/examples/tests/catj_test.ts14
-rw-r--r--std/examples/tests/echo_server_test.ts4
2 files changed, 10 insertions, 8 deletions
diff --git a/std/examples/tests/catj_test.ts b/std/examples/tests/catj_test.ts
index a859db0c1..58533ab60 100644
--- a/std/examples/tests/catj_test.ts
+++ b/std/examples/tests/catj_test.ts
@@ -17,7 +17,7 @@ Deno.test("[examples/catj] print an array", async () => {
assertStrictEquals(actual, expected);
} finally {
- process.stdin!.close();
+ process.stdin.close();
process.close();
}
});
@@ -36,7 +36,7 @@ Deno.test("[examples/catj] print an object", async () => {
assertStrictEquals(actual, expected);
} finally {
- process.stdin!.close();
+ process.stdin.close();
process.close();
}
});
@@ -54,7 +54,7 @@ Deno.test("[examples/catj] print multiple files", async () => {
assertStrictEquals(actual, expected);
} finally {
- process.stdin!.close();
+ process.stdin.close();
process.close();
}
});
@@ -64,8 +64,8 @@ Deno.test("[examples/catj] read from stdin", async () => {
const process = catj("-");
const input = `{ "foo": "bar" }`;
try {
- await process.stdin!.write(new TextEncoder().encode(input));
- process.stdin!.close();
+ await process.stdin.write(new TextEncoder().encode(input));
+ process.stdin.close();
const output = await process.output();
const actual = decoder.decode(output).trim();
@@ -75,7 +75,9 @@ Deno.test("[examples/catj] read from stdin", async () => {
}
});
-function catj(...files: string[]): Deno.Process {
+function catj(
+ ...files: string[]
+): Deno.Process<Deno.RunOptions & { stdin: "piped"; stdout: "piped" }> {
return Deno.run({
cmd: [Deno.execPath(), "run", "--allow-read", "catj.ts", ...files],
cwd: "examples",
diff --git a/std/examples/tests/echo_server_test.ts b/std/examples/tests/echo_server_test.ts
index 475b0f73f..2cf52e466 100644
--- a/std/examples/tests/echo_server_test.ts
+++ b/std/examples/tests/echo_server_test.ts
@@ -13,7 +13,7 @@ Deno.test("[examples/echo_server]", async () => {
let conn: Deno.Conn | undefined;
try {
- const processReader = new BufReader(process.stdout!);
+ const processReader = new BufReader(process.stdout);
const message = await processReader.readLine();
assertNotEquals(message, null);
@@ -38,7 +38,7 @@ Deno.test("[examples/echo_server]", async () => {
assertStrictEquals(actualResponse, expectedResponse);
} finally {
conn?.close();
- process.stdout!.close();
+ process.stdout.close();
process.close();
}
});