diff options
author | Casper Beyer <caspervonb@pm.me> | 2021-09-23 07:50:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-23 01:50:50 +0200 |
commit | 830586d242216e64fcd16e65cc83db9d54d63dc0 (patch) | |
tree | a84f0090faaa14879693016e9d9b13fcfbb92dcd /cli/tests/unit/files_test.ts | |
parent | 87e78802b0ae65cc57d66eaa8e5265f74cf69092 (diff) |
test(cli): align unit test permissions with runtime test permissions (#12189)
Diffstat (limited to 'cli/tests/unit/files_test.ts')
-rw-r--r-- | cli/tests/unit/files_test.ts | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/cli/tests/unit/files_test.ts b/cli/tests/unit/files_test.ts index 65504f23f..410c89de9 100644 --- a/cli/tests/unit/files_test.ts +++ b/cli/tests/unit/files_test.ts @@ -11,7 +11,7 @@ unitTest(function filesStdioFileDescriptors() { assertEquals(Deno.stderr.rid, 2); }); -unitTest({ perms: { read: true } }, async function filesCopyToStdout() { +unitTest({ permissions: { read: true } }, async function filesCopyToStdout() { const filename = "cli/tests/testdata/fixture.json"; const file = await Deno.open(filename); assert(file.rid > 2); @@ -21,7 +21,7 @@ unitTest({ perms: { read: true } }, async function filesCopyToStdout() { file.close(); }); -unitTest({ perms: { read: true } }, async function filesIter() { +unitTest({ permissions: { read: true } }, async function filesIter() { const filename = "cli/tests/testdata/hello.txt"; const file = await Deno.open(filename); @@ -35,7 +35,7 @@ unitTest({ perms: { read: true } }, async function filesIter() { }); unitTest( - { perms: { read: true } }, + { permissions: { read: true } }, async function filesIterCustomBufSize() { const filename = "cli/tests/testdata/hello.txt"; const file = await Deno.open(filename); @@ -53,7 +53,7 @@ unitTest( }, ); -unitTest({ perms: { read: true } }, function filesIterSync() { +unitTest({ permissions: { read: true } }, function filesIterSync() { const filename = "cli/tests/testdata/hello.txt"; const file = Deno.openSync(filename); @@ -67,7 +67,7 @@ unitTest({ perms: { read: true } }, function filesIterSync() { }); unitTest( - { perms: { read: true } }, + { permissions: { read: true } }, function filesIterSyncCustomBufSize() { const filename = "cli/tests/testdata/hello.txt"; const file = Deno.openSync(filename); @@ -157,7 +157,7 @@ unitTest(async function readerIterSync() { unitTest( { - perms: { read: true, write: true }, + permissions: { read: true, write: true }, }, function openSyncMode() { const path = Deno.makeTempDirSync() + "/test_openSync.txt"; @@ -176,7 +176,7 @@ unitTest( unitTest( { - perms: { read: true, write: true }, + permissions: { read: true, write: true }, }, async function openMode() { const path = (await Deno.makeTempDir()) + "/test_open.txt"; @@ -195,7 +195,7 @@ unitTest( unitTest( { - perms: { read: true, write: true }, + permissions: { read: true, write: true }, }, function openSyncUrl() { const tempDir = Deno.makeTempDirSync(); @@ -221,7 +221,7 @@ unitTest( unitTest( { - perms: { read: true, write: true }, + permissions: { read: true, write: true }, }, async function openUrl() { const tempDir = await Deno.makeTempDir(); @@ -246,7 +246,7 @@ unitTest( ); unitTest( - { perms: { write: false } }, + { permissions: { write: false } }, async function writePermFailure() { const filename = "tests/hello.txt"; const openOptions: Deno.OpenOptions[] = [{ write: true }, { append: true }]; @@ -293,14 +293,14 @@ unitTest(async function openOptions() { ); }); -unitTest({ perms: { read: false } }, async function readPermFailure() { +unitTest({ permissions: { read: false } }, async function readPermFailure() { await assertRejects(async () => { await Deno.open("package.json", { read: true }); }, Deno.errors.PermissionDenied); }); unitTest( - { perms: { write: true } }, + { permissions: { write: true } }, async function writeNullBufferFailure() { const tempDir = Deno.makeTempDirSync(); const filename = tempDir + "hello.txt"; @@ -324,7 +324,7 @@ unitTest( ); unitTest( - { perms: { write: true, read: true } }, + { permissions: { write: true, read: true } }, async function readNullBufferFailure() { const tempDir = Deno.makeTempDirSync(); const filename = tempDir + "hello.txt"; @@ -352,7 +352,7 @@ unitTest( ); unitTest( - { perms: { write: false, read: false } }, + { permissions: { write: false, read: false } }, async function readWritePermFailure() { const filename = "tests/hello.txt"; await assertRejects(async () => { @@ -362,7 +362,7 @@ unitTest( ); unitTest( - { perms: { read: true, write: true } }, + { permissions: { read: true, write: true } }, async function createFile() { const tempDir = await Deno.makeTempDir(); const filename = tempDir + "/test.txt"; @@ -383,7 +383,7 @@ unitTest( ); unitTest( - { perms: { read: true, write: true } }, + { permissions: { read: true, write: true } }, async function createFileWithUrl() { const tempDir = await Deno.makeTempDir(); const fileUrl = new URL( @@ -405,7 +405,7 @@ unitTest( ); unitTest( - { perms: { read: true, write: true } }, + { permissions: { read: true, write: true } }, async function createSyncFile() { const tempDir = await Deno.makeTempDir(); const filename = tempDir + "/test.txt"; @@ -426,7 +426,7 @@ unitTest( ); unitTest( - { perms: { read: true, write: true } }, + { permissions: { read: true, write: true } }, async function createSyncFileWithUrl() { const tempDir = await Deno.makeTempDir(); const fileUrl = new URL( @@ -448,7 +448,7 @@ unitTest( ); unitTest( - { perms: { read: true, write: true } }, + { permissions: { read: true, write: true } }, async function openModeWrite() { const tempDir = Deno.makeTempDirSync(); const encoder = new TextEncoder(); @@ -491,7 +491,7 @@ unitTest( ); unitTest( - { perms: { read: true, write: true } }, + { permissions: { read: true, write: true } }, async function openModeWriteRead() { const tempDir = Deno.makeTempDirSync(); const encoder = new TextEncoder(); @@ -526,7 +526,7 @@ unitTest( }, ); -unitTest({ perms: { read: true } }, async function seekStart() { +unitTest({ permissions: { read: true } }, async function seekStart() { const filename = "cli/tests/testdata/hello.txt"; const file = await Deno.open(filename); const seekPosition = 6; @@ -543,7 +543,7 @@ unitTest({ perms: { read: true } }, async function seekStart() { file.close(); }); -unitTest({ perms: { read: true } }, function seekSyncStart() { +unitTest({ permissions: { read: true } }, function seekSyncStart() { const filename = "cli/tests/testdata/hello.txt"; const file = Deno.openSync(filename); const seekPosition = 6; @@ -560,7 +560,7 @@ unitTest({ perms: { read: true } }, function seekSyncStart() { file.close(); }); -unitTest({ perms: { read: true } }, async function seekCurrent() { +unitTest({ permissions: { read: true } }, async function seekCurrent() { const filename = "cli/tests/testdata/hello.txt"; const file = await Deno.open(filename); // Deliberately move 1 step forward @@ -577,7 +577,7 @@ unitTest({ perms: { read: true } }, async function seekCurrent() { file.close(); }); -unitTest({ perms: { read: true } }, function seekSyncCurrent() { +unitTest({ permissions: { read: true } }, function seekSyncCurrent() { const filename = "cli/tests/testdata/hello.txt"; const file = Deno.openSync(filename); // Deliberately move 1 step forward @@ -594,7 +594,7 @@ unitTest({ perms: { read: true } }, function seekSyncCurrent() { file.close(); }); -unitTest({ perms: { read: true } }, async function seekEnd() { +unitTest({ permissions: { read: true } }, async function seekEnd() { const filename = "cli/tests/testdata/hello.txt"; const file = await Deno.open(filename); const seekPosition = -6; @@ -608,7 +608,7 @@ unitTest({ perms: { read: true } }, async function seekEnd() { file.close(); }); -unitTest({ perms: { read: true } }, function seekSyncEnd() { +unitTest({ permissions: { read: true } }, function seekSyncEnd() { const filename = "cli/tests/testdata/hello.txt"; const file = Deno.openSync(filename); const seekPosition = -6; @@ -622,7 +622,7 @@ unitTest({ perms: { read: true } }, function seekSyncEnd() { file.close(); }); -unitTest({ perms: { read: true } }, async function seekMode() { +unitTest({ permissions: { read: true } }, async function seekMode() { const filename = "cli/tests/testdata/hello.txt"; const file = await Deno.open(filename); await assertRejects( |