mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 12:49:10 +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
|
@ -1,12 +1,12 @@
|
|||
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
||||
import { assert, assertEquals, assertThrows, unitTest } from "./test_util.ts";
|
||||
|
||||
unitTest({ perms: { read: true } }, function dirCwdNotNull() {
|
||||
unitTest({ permissions: { read: true } }, function dirCwdNotNull() {
|
||||
assert(Deno.cwd() != null);
|
||||
});
|
||||
|
||||
unitTest(
|
||||
{ perms: { read: true, write: true } },
|
||||
{ permissions: { read: true, write: true } },
|
||||
function dirCwdChdirSuccess() {
|
||||
const initialdir = Deno.cwd();
|
||||
const path = Deno.makeTempDirSync();
|
||||
|
@ -21,7 +21,7 @@ unitTest(
|
|||
},
|
||||
);
|
||||
|
||||
unitTest({ perms: { read: true, write: true } }, function dirCwdError() {
|
||||
unitTest({ permissions: { read: true, write: true } }, function dirCwdError() {
|
||||
// excluding windows since it throws resource busy, while removeSync
|
||||
if (["linux", "darwin"].includes(Deno.build.os)) {
|
||||
const initialdir = Deno.cwd();
|
||||
|
@ -38,7 +38,7 @@ unitTest({ perms: { read: true, write: true } }, function dirCwdError() {
|
|||
}
|
||||
});
|
||||
|
||||
unitTest({ perms: { read: false } }, function dirCwdPermError() {
|
||||
unitTest({ permissions: { read: false } }, function dirCwdPermError() {
|
||||
assertThrows(
|
||||
() => {
|
||||
Deno.cwd();
|
||||
|
@ -49,7 +49,7 @@ unitTest({ perms: { read: false } }, function dirCwdPermError() {
|
|||
});
|
||||
|
||||
unitTest(
|
||||
{ perms: { read: true, write: true } },
|
||||
{ permissions: { read: true, write: true } },
|
||||
function dirChdirError() {
|
||||
const path = Deno.makeTempDirSync() + "test";
|
||||
assertThrows(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue