Skip to content

Commit 6558dcb

Browse files
Masashi HiranoBridgeAR
Masashi Hirano
authored andcommitted
test: add test for fs.promises.lchmod
To increase test coverage for fs.promises by adding a test for lchmod. PR-URL: #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]>
1 parent 2cd3e61 commit 6558dcb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/parallel/test-fs-promises.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const {
1212
chmod,
1313
copyFile,
1414
link,
15+
lchmod,
1516
lstat,
1617
mkdir,
1718
mkdtemp,
@@ -129,14 +130,21 @@ function verifyStatObject(stat) {
129130
if (common.canCreateSymLink()) {
130131
const newLink = path.resolve(tmpDir, 'baz3.js');
131132
await symlink(newPath, newLink);
132-
133133
stats = await lstat(newLink);
134134
verifyStatObject(stats);
135135

136136
assert.strictEqual(newPath.toLowerCase(),
137137
(await realpath(newLink)).toLowerCase());
138138
assert.strictEqual(newPath.toLowerCase(),
139139
(await readlink(newLink)).toLowerCase());
140+
if (common.isOSX) {
141+
// lchmod is only available on macOS
142+
const newMode = 0o666;
143+
await lchmod(newLink, newMode);
144+
stats = await lstat(newLink);
145+
assert.strictEqual(stats.mode & 0o777, newMode);
146+
}
147+
140148

141149
await unlink(newLink);
142150
}

0 commit comments

Comments
 (0)