Skip to content

Commit

Permalink
test: add test for fsPromises.lchmod
Browse files Browse the repository at this point in the history
To increase test coverage for fs/promises,
add test for fsPromises.lchmod.
  • Loading branch information
Masashi Hirano committed May 25, 2018
1 parent 468ab45 commit 8a574c3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions 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 @@ -128,7 +129,9 @@ function verifyStatObject(stat) {

if (common.canCreateSymLink()) {
const newLink = path.resolve(tmpDir, 'baz3.js');
const newMode = 0o666;
await symlink(newPath, newLink);
await lchmod(newLink, newMode);

stats = await lstat(newLink);
verifyStatObject(stats);
Expand All @@ -137,6 +140,7 @@ function verifyStatObject(stat) {
(await realpath(newLink)).toLowerCase());
assert.strictEqual(newPath.toLowerCase(),
(await readlink(newLink)).toLowerCase());
assert.strictEqual(stats.mode & 0o777, newMode);

await unlink(newLink);
}
Expand Down

0 comments on commit 8a574c3

Please sign in to comment.