Skip to content

Commit

Permalink
test: add test for fs.promises.lchmod
Browse files Browse the repository at this point in the history
To increase test coverage for fs.promises by adding a test for
lchmod.

PR-URL: nodejs#20584
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
Masashi Hirano authored and BridgeAR committed May 30, 2018
1 parent 2cd3e61 commit 6558dcb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/parallel/test-fs-promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const {
chmod,
copyFile,
link,
lchmod,
lstat,
mkdir,
mkdtemp,
Expand Down Expand Up @@ -129,14 +130,21 @@ function verifyStatObject(stat) {
if (common.canCreateSymLink()) {
const newLink = path.resolve(tmpDir, 'baz3.js');
await symlink(newPath, newLink);

stats = await lstat(newLink);
verifyStatObject(stats);

assert.strictEqual(newPath.toLowerCase(),
(await realpath(newLink)).toLowerCase());
assert.strictEqual(newPath.toLowerCase(),
(await readlink(newLink)).toLowerCase());
if (common.isOSX) {
// lchmod is only available on macOS
const newMode = 0o666;
await lchmod(newLink, newMode);
stats = await lstat(newLink);
assert.strictEqual(stats.mode & 0o777, newMode);
}


await unlink(newLink);
}
Expand Down

0 comments on commit 6558dcb

Please sign in to comment.