summaryrefslogtreecommitdiff
path: root/cli/tests/unit/read_file_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit/read_file_test.ts')
-rw-r--r--cli/tests/unit/read_file_test.ts22
1 files changed, 13 insertions, 9 deletions
diff --git a/cli/tests/unit/read_file_test.ts b/cli/tests/unit/read_file_test.ts
index f638c7a7c..7dd2b5621 100644
--- a/cli/tests/unit/read_file_test.ts
+++ b/cli/tests/unit/read_file_test.ts
@@ -9,7 +9,7 @@ import {
} from "./test_util.ts";
unitTest({ perms: { read: true } }, function readFileSyncSuccess() {
- const data = Deno.readFileSync("cli/tests/fixture.json");
+ const data = Deno.readFileSync("cli/tests/testdata/fixture.json");
assert(data.byteLength > 0);
const decoder = new TextDecoder("utf-8");
const json = decoder.decode(data);
@@ -19,7 +19,7 @@ unitTest({ perms: { read: true } }, function readFileSyncSuccess() {
unitTest({ perms: { read: true } }, function readFileSyncUrl() {
const data = Deno.readFileSync(
- pathToAbsoluteFileUrl("cli/tests/fixture.json"),
+ pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"),
);
assert(data.byteLength > 0);
const decoder = new TextDecoder("utf-8");
@@ -30,7 +30,7 @@ unitTest({ perms: { read: true } }, function readFileSyncUrl() {
unitTest({ perms: { read: false } }, function readFileSyncPerm() {
assertThrows(() => {
- Deno.readFileSync("cli/tests/fixture.json");
+ Deno.readFileSync("cli/tests/testdata/fixture.json");
}, Deno.errors.PermissionDenied);
});
@@ -42,7 +42,7 @@ unitTest({ perms: { read: true } }, function readFileSyncNotFound() {
unitTest({ perms: { read: true } }, async function readFileUrl() {
const data = await Deno.readFile(
- pathToAbsoluteFileUrl("cli/tests/fixture.json"),
+ pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"),
);
assert(data.byteLength > 0);
const decoder = new TextDecoder("utf-8");
@@ -52,7 +52,7 @@ unitTest({ perms: { read: true } }, async function readFileUrl() {
});
unitTest({ perms: { read: true } }, async function readFileSuccess() {
- const data = await Deno.readFile("cli/tests/fixture.json");
+ const data = await Deno.readFile("cli/tests/testdata/fixture.json");
assert(data.byteLength > 0);
const decoder = new TextDecoder("utf-8");
const json = decoder.decode(data);
@@ -62,13 +62,13 @@ unitTest({ perms: { read: true } }, async function readFileSuccess() {
unitTest({ perms: { read: false } }, async function readFilePerm() {
await assertThrowsAsync(async () => {
- await Deno.readFile("cli/tests/fixture.json");
+ await Deno.readFile("cli/tests/testdata/fixture.json");
}, Deno.errors.PermissionDenied);
});
unitTest({ perms: { read: true } }, function readFileSyncLoop() {
for (let i = 0; i < 256; i++) {
- Deno.readFileSync("cli/tests/fixture.json");
+ Deno.readFileSync("cli/tests/testdata/fixture.json");
}
});
@@ -96,7 +96,9 @@ unitTest(
const ac = new AbortController();
queueMicrotask(() => ac.abort());
await assertThrowsAsync(async () => {
- await Deno.readFile("cli/tests/fixture.json", { signal: ac.signal });
+ await Deno.readFile("cli/tests/testdata/fixture.json", {
+ signal: ac.signal,
+ });
});
},
);
@@ -107,7 +109,9 @@ unitTest(
const ac = new AbortController();
queueMicrotask(() => ac.abort());
await assertThrowsAsync(async () => {
- await Deno.readTextFile("cli/tests/fixture.json", { signal: ac.signal });
+ await Deno.readTextFile("cli/tests/testdata/fixture.json", {
+ signal: ac.signal,
+ });
});
},
);