mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 18:38:33 +00:00
test(cli): align unit test permissions with runtime test permissions (#12189)
This commit is contained in:
parent
87e78802b0
commit
830586d242
45 changed files with 664 additions and 574 deletions
|
@ -9,7 +9,7 @@ import {
|
|||
unitTest,
|
||||
} from "./test_util.ts";
|
||||
|
||||
unitTest({ perms: { read: true } }, function realPathSyncSuccess() {
|
||||
unitTest({ permissions: { read: true } }, function realPathSyncSuccess() {
|
||||
const relative = "cli/tests/testdata/fixture.json";
|
||||
const realPath = Deno.realPathSync(relative);
|
||||
if (Deno.build.os !== "windows") {
|
||||
|
@ -21,7 +21,7 @@ unitTest({ perms: { read: true } }, function realPathSyncSuccess() {
|
|||
}
|
||||
});
|
||||
|
||||
unitTest({ perms: { read: true } }, function realPathSyncUrl() {
|
||||
unitTest({ permissions: { read: true } }, function realPathSyncUrl() {
|
||||
const relative = "cli/tests/testdata/fixture.json";
|
||||
const url = pathToAbsoluteFileUrl(relative);
|
||||
assertEquals(Deno.realPathSync(relative), Deno.realPathSync(url));
|
||||
|
@ -29,7 +29,7 @@ unitTest({ perms: { read: true } }, function realPathSyncUrl() {
|
|||
|
||||
unitTest(
|
||||
{
|
||||
perms: { read: true, write: true },
|
||||
permissions: { read: true, write: true },
|
||||
},
|
||||
function realPathSyncSymlink() {
|
||||
const testDir = Deno.makeTempDirSync();
|
||||
|
@ -48,19 +48,19 @@ unitTest(
|
|||
},
|
||||
);
|
||||
|
||||
unitTest({ perms: { read: false } }, function realPathSyncPerm() {
|
||||
unitTest({ permissions: { read: false } }, function realPathSyncPerm() {
|
||||
assertThrows(() => {
|
||||
Deno.realPathSync("some_file");
|
||||
}, Deno.errors.PermissionDenied);
|
||||
});
|
||||
|
||||
unitTest({ perms: { read: true } }, function realPathSyncNotFound() {
|
||||
unitTest({ permissions: { read: true } }, function realPathSyncNotFound() {
|
||||
assertThrows(() => {
|
||||
Deno.realPathSync("bad_filename");
|
||||
}, Deno.errors.NotFound);
|
||||
});
|
||||
|
||||
unitTest({ perms: { read: true } }, async function realPathSuccess() {
|
||||
unitTest({ permissions: { read: true } }, async function realPathSuccess() {
|
||||
const relativePath = "cli/tests/testdata/fixture.json";
|
||||
const realPath = await Deno.realPath(relativePath);
|
||||
if (Deno.build.os !== "windows") {
|
||||
|
@ -73,7 +73,7 @@ unitTest({ perms: { read: true } }, async function realPathSuccess() {
|
|||
});
|
||||
|
||||
unitTest(
|
||||
{ perms: { read: true } },
|
||||
{ permissions: { read: true } },
|
||||
async function realPathUrl() {
|
||||
const relative = "cli/tests/testdata/fixture.json";
|
||||
const url = pathToAbsoluteFileUrl(relative);
|
||||
|
@ -83,7 +83,7 @@ unitTest(
|
|||
|
||||
unitTest(
|
||||
{
|
||||
perms: { read: true, write: true },
|
||||
permissions: { read: true, write: true },
|
||||
},
|
||||
async function realPathSymlink() {
|
||||
const testDir = Deno.makeTempDirSync();
|
||||
|
@ -102,13 +102,13 @@ unitTest(
|
|||
},
|
||||
);
|
||||
|
||||
unitTest({ perms: { read: false } }, async function realPathPerm() {
|
||||
unitTest({ permissions: { read: false } }, async function realPathPerm() {
|
||||
await assertRejects(async () => {
|
||||
await Deno.realPath("some_file");
|
||||
}, Deno.errors.PermissionDenied);
|
||||
});
|
||||
|
||||
unitTest({ perms: { read: true } }, async function realPathNotFound() {
|
||||
unitTest({ permissions: { read: true } }, async function realPathNotFound() {
|
||||
await assertRejects(async () => {
|
||||
await Deno.realPath("bad_filename");
|
||||
}, Deno.errors.NotFound);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue