diff options
author | futsuuu <105504350+futsuuu@users.noreply.github.com> | 2024-05-14 22:06:21 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-14 15:06:21 +0200 |
commit | c0a600786e32fa5e61ca40ef184772241446e33d (patch) | |
tree | f7d17db21d8718a34e2057e538f1e7b5a6574563 /tests/unit/symlink_test.ts | |
parent | 6084cf60ba0786a82aae60ad179187f17bb7dc14 (diff) |
fix: Add missing `"junction"` type for `SymlinkOptions.types` (#23756)
Junction symlink support is added in #22762, but `SymlinkOptions` and
its documents are not updated.
Diffstat (limited to 'tests/unit/symlink_test.ts')
-rw-r--r-- | tests/unit/symlink_test.ts | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/unit/symlink_test.ts b/tests/unit/symlink_test.ts index 310c36930..0ee4a36fd 100644 --- a/tests/unit/symlink_test.ts +++ b/tests/unit/symlink_test.ts @@ -40,6 +40,24 @@ Deno.test( ); Deno.test( + { + ignore: Deno.build.os !== "windows", + permissions: { read: true, write: true }, + }, + function symlinkSyncJunction() { + const testDir = Deno.makeTempDirSync(); + const oldname = testDir + "/oldname"; + const newname = testDir + "/newname"; + Deno.mkdirSync(oldname); + Deno.symlinkSync(oldname, newname, { type: "junction" }); + const newNameInfoLStat = Deno.lstatSync(newname); + const newNameInfoStat = Deno.statSync(newname); + assert(newNameInfoLStat.isSymlink); + assert(newNameInfoStat.isDirectory); + }, +); + +Deno.test( { permissions: { read: false, write: false } }, function symlinkSyncPerm() { assertThrows(() => { @@ -97,6 +115,24 @@ Deno.test( ); Deno.test( + { + ignore: Deno.build.os !== "windows", + permissions: { read: true, write: true }, + }, + async function symlinkJunction() { + const testDir = Deno.makeTempDirSync(); + const oldname = testDir + "/oldname"; + const newname = testDir + "/newname"; + Deno.mkdirSync(oldname); + await Deno.symlink(oldname, newname, { type: "junction" }); + const newNameInfoLStat = Deno.lstatSync(newname); + const newNameInfoStat = Deno.statSync(newname); + assert(newNameInfoLStat.isSymlink, "NOT SYMLINK"); + assert(newNameInfoStat.isDirectory, "NOT DIRECTORY"); + }, +); + +Deno.test( { permissions: { read: true, write: true } }, async function symlinkAlreadyExist() { const existingFile = Deno.makeTempFileSync(); |