Skip to content

Commit c05c73a

Browse files
committed
test: add test cases for fsPromises
Add tests of lchmod, chown, fchown and lchown. PR-URL: #19064 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 81d73fe commit c05c73a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/parallel/test-fs-promises.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ const fsPromises = require('fs/promises');
99
const {
1010
access,
1111
chmod,
12+
chown,
1213
copyFile,
1314
fchmod,
15+
fchown,
1416
fdatasync,
1517
fstat,
1618
fsync,
@@ -27,6 +29,8 @@ const {
2729
realpath,
2830
rename,
2931
rmdir,
32+
lchmod,
33+
lchown,
3034
stat,
3135
symlink,
3236
write,
@@ -95,6 +99,21 @@ function verifyStatObject(stat) {
9599

96100
await chmod(dest, 0o666);
97101
await fchmod(handle, 0o666);
102+
// lchmod is only available on OSX
103+
if (common.isOSX) {
104+
await lchmod(dest, 0o666);
105+
}
106+
107+
if (!common.isWindows) {
108+
const gid = process.getgid();
109+
const uid = process.getuid();
110+
await chown(dest, uid, gid);
111+
await fchown(handle, uid, gid);
112+
// lchown is only available on OSX
113+
if (common.isOSX) {
114+
await lchown(dest, uid, gid);
115+
}
116+
}
98117

99118
await utimes(dest, new Date(), new Date());
100119

0 commit comments

Comments
 (0)