summaryrefslogtreecommitdiff
path: root/cli/tests/unit/stat_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit/stat_test.ts')
-rw-r--r--cli/tests/unit/stat_test.ts38
1 files changed, 22 insertions, 16 deletions
diff --git a/cli/tests/unit/stat_test.ts b/cli/tests/unit/stat_test.ts
index 3630e369c..362899128 100644
--- a/cli/tests/unit/stat_test.ts
+++ b/cli/tests/unit/stat_test.ts
@@ -8,7 +8,7 @@ import {
unitTest,
} from "./test_util.ts";
-unitTest({ perms: { read: true } }, function fstatSyncSuccess() {
+unitTest({ permissions: { read: true } }, function fstatSyncSuccess() {
const file = Deno.openSync("README.md");
const fileInfo = Deno.fstatSync(file.rid);
assert(fileInfo.isFile);
@@ -23,7 +23,7 @@ unitTest({ perms: { read: true } }, function fstatSyncSuccess() {
Deno.close(file.rid);
});
-unitTest({ perms: { read: true } }, async function fstatSuccess() {
+unitTest({ permissions: { read: true } }, async function fstatSuccess() {
const file = await Deno.open("README.md");
const fileInfo = await Deno.fstat(file.rid);
assert(fileInfo.isFile);
@@ -39,7 +39,7 @@ unitTest({ perms: { read: true } }, async function fstatSuccess() {
});
unitTest(
- { perms: { read: true, write: true } },
+ { permissions: { read: true, write: true } },
function statSyncSuccess() {
const readmeInfo = Deno.statSync("README.md");
assert(readmeInfo.isFile);
@@ -101,19 +101,19 @@ unitTest(
},
);
-unitTest({ perms: { read: false } }, function statSyncPerm() {
+unitTest({ permissions: { read: false } }, function statSyncPerm() {
assertThrows(() => {
Deno.statSync("README.md");
}, Deno.errors.PermissionDenied);
});
-unitTest({ perms: { read: true } }, function statSyncNotFound() {
+unitTest({ permissions: { read: true } }, function statSyncNotFound() {
assertThrows(() => {
Deno.statSync("bad_file_name");
}, Deno.errors.NotFound);
});
-unitTest({ perms: { read: true } }, function lstatSyncSuccess() {
+unitTest({ permissions: { read: true } }, function lstatSyncSuccess() {
const packageInfo = Deno.lstatSync("README.md");
assert(packageInfo.isFile);
assert(!packageInfo.isSymlink);
@@ -141,20 +141,20 @@ unitTest({ perms: { read: true } }, function lstatSyncSuccess() {
assert(!coreInfoByUrl.isSymlink);
});
-unitTest({ perms: { read: false } }, function lstatSyncPerm() {
+unitTest({ permissions: { read: false } }, function lstatSyncPerm() {
assertThrows(() => {
Deno.lstatSync("hello.txt");
}, Deno.errors.PermissionDenied);
});
-unitTest({ perms: { read: true } }, function lstatSyncNotFound() {
+unitTest({ permissions: { read: true } }, function lstatSyncNotFound() {
assertThrows(() => {
Deno.lstatSync("bad_file_name");
}, Deno.errors.NotFound);
});
unitTest(
- { perms: { read: true, write: true } },
+ { permissions: { read: true, write: true } },
async function statSuccess() {
const readmeInfo = await Deno.stat("README.md");
assert(readmeInfo.isFile);
@@ -219,13 +219,13 @@ unitTest(
},
);
-unitTest({ perms: { read: false } }, async function statPerm() {
+unitTest({ permissions: { read: false } }, async function statPerm() {
await assertRejects(async () => {
await Deno.stat("README.md");
}, Deno.errors.PermissionDenied);
});
-unitTest({ perms: { read: true } }, async function statNotFound() {
+unitTest({ permissions: { read: true } }, async function statNotFound() {
await assertRejects(
async () => {
await Deno.stat("bad_file_name"), Deno.errors.NotFound;
@@ -233,7 +233,7 @@ unitTest({ perms: { read: true } }, async function statNotFound() {
);
});
-unitTest({ perms: { read: true } }, async function lstatSuccess() {
+unitTest({ permissions: { read: true } }, async function lstatSuccess() {
const readmeInfo = await Deno.lstat("README.md");
assert(readmeInfo.isFile);
assert(!readmeInfo.isSymlink);
@@ -261,20 +261,23 @@ unitTest({ perms: { read: true } }, async function lstatSuccess() {
assert(!coreInfoByUrl.isSymlink);
});
-unitTest({ perms: { read: false } }, async function lstatPerm() {
+unitTest({ permissions: { read: false } }, async function lstatPerm() {
await assertRejects(async () => {
await Deno.lstat("README.md");
}, Deno.errors.PermissionDenied);
});
-unitTest({ perms: { read: true } }, async function lstatNotFound() {
+unitTest({ permissions: { read: true } }, async function lstatNotFound() {
await assertRejects(async () => {
await Deno.lstat("bad_file_name");
}, Deno.errors.NotFound);
});
unitTest(
- { ignore: Deno.build.os !== "windows", perms: { read: true, write: true } },
+ {
+ ignore: Deno.build.os !== "windows",
+ permissions: { read: true, write: true },
+ },
function statNoUnixFields() {
const enc = new TextEncoder();
const data = enc.encode("Hello");
@@ -295,7 +298,10 @@ unitTest(
);
unitTest(
- { ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
+ {
+ ignore: Deno.build.os === "windows",
+ permissions: { read: true, write: true },
+ },
function statUnixFields() {
const enc = new TextEncoder();
const data = enc.encode("Hello");