summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorBenjamin Gruenbaum <benjamingr@gmail.com>2021-06-22 18:45:26 +0300
committerGitHub <noreply@github.com>2021-06-22 11:45:26 -0400
commit20b0a5125a80c027f21472eec98f29e5e35629fb (patch)
treef6551848efdd0c1ae87144e78da4c127b46f51ed /cli/tests
parent9c0b41e24bc5f4ec08c62517f40b74506ac9f0d1 (diff)
feat(core): support AbortSignal in readFile (#10943)
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/unit/read_file_test.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/cli/tests/unit/read_file_test.ts b/cli/tests/unit/read_file_test.ts
index 5f8ee2c11..d8d1cddf2 100644
--- a/cli/tests/unit/read_file_test.ts
+++ b/cli/tests/unit/read_file_test.ts
@@ -95,3 +95,25 @@ unitTest(
assertEquals(resourcesBefore, Deno.resources());
},
);
+
+unitTest(
+ { perms: { read: true } },
+ async function readFileWithAbortSignal(): Promise<void> {
+ const ac = new AbortController();
+ queueMicrotask(() => ac.abort());
+ await assertThrowsAsync(async () => {
+ await Deno.readFile("cli/tests/fixture.json", { signal: ac.signal });
+ });
+ },
+);
+
+unitTest(
+ { perms: { read: true } },
+ async function readTextileWithAbortSignal(): Promise<void> {
+ const ac = new AbortController();
+ queueMicrotask(() => ac.abort());
+ await assertThrowsAsync(async () => {
+ await Deno.readTextFile("cli/tests/fixture.json", { signal: ac.signal });
+ });
+ },
+);