Skip to content

Commit ff5f20f

Browse files
Masashi Hiranoaddaleax
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 44ef458 commit ff5f20f

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
@@ -18,6 +18,7 @@ const {
1818
ftruncate,
1919
futimes,
2020
link,
21+
lchmod,
2122
lstat,
2223
mkdir,
2324
mkdtemp,
@@ -160,14 +161,21 @@ function verifyStatObject(stat) {
160161
if (common.canCreateSymLink()) {
161162
const newLink = path.resolve(tmpDir, 'baz3.js');
162163
await symlink(newPath, newLink);
163-
164164
stats = await lstat(newLink);
165165
verifyStatObject(stats);
166166

167167
assert.strictEqual(newPath.toLowerCase(),
168168
(await realpath(newLink)).toLowerCase());
169169
assert.strictEqual(newPath.toLowerCase(),
170170
(await readlink(newLink)).toLowerCase());
171+
if (common.isOSX) {
172+
// lchmod is only available on macOS
173+
const newMode = 0o666;
174+
await lchmod(newLink, newMode);
175+
stats = await lstat(newLink);
176+
assert.strictEqual(stats.mode & 0o777, newMode);
177+
}
178+
171179

172180
await unlink(newLink);
173181
}

0 commit comments

Comments
 (0)