test: add test cases for fsPromises
Add tests of lchmod, chown, fchown and lchown. PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
81d73fe83e
commit
c05c73a634
@ -9,8 +9,10 @@ const fsPromises = require('fs/promises');
|
|||||||
const {
|
const {
|
||||||
access,
|
access,
|
||||||
chmod,
|
chmod,
|
||||||
|
chown,
|
||||||
copyFile,
|
copyFile,
|
||||||
fchmod,
|
fchmod,
|
||||||
|
fchown,
|
||||||
fdatasync,
|
fdatasync,
|
||||||
fstat,
|
fstat,
|
||||||
fsync,
|
fsync,
|
||||||
@ -27,6 +29,8 @@ const {
|
|||||||
realpath,
|
realpath,
|
||||||
rename,
|
rename,
|
||||||
rmdir,
|
rmdir,
|
||||||
|
lchmod,
|
||||||
|
lchown,
|
||||||
stat,
|
stat,
|
||||||
symlink,
|
symlink,
|
||||||
write,
|
write,
|
||||||
@ -95,6 +99,21 @@ function verifyStatObject(stat) {
|
|||||||
|
|
||||||
await chmod(dest, 0o666);
|
await chmod(dest, 0o666);
|
||||||
await fchmod(handle, 0o666);
|
await fchmod(handle, 0o666);
|
||||||
|
// lchmod is only available on OSX
|
||||||
|
if (common.isOSX) {
|
||||||
|
await lchmod(dest, 0o666);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!common.isWindows) {
|
||||||
|
const gid = process.getgid();
|
||||||
|
const uid = process.getuid();
|
||||||
|
await chown(dest, uid, gid);
|
||||||
|
await fchown(handle, uid, gid);
|
||||||
|
// lchown is only available on OSX
|
||||||
|
if (common.isOSX) {
|
||||||
|
await lchown(dest, uid, gid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await utimes(dest, new Date(), new Date());
|
await utimes(dest, new Date(), new Date());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user