mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
test: test mode passed as an options object in mkdir/mkdirSync
Add tests for mode passed as an options object in fs.mkdir() and fs.mkdirSync(). This also adds coverage for mkdirSync() inside the conditional where options.mode is not undefined. PR-URL: https://github.com/nodejs/node/pull/37008 Refs: https://coverage.nodejs.org/coverage-e3e054d020ee5ef6/lib/fs.js.html#L1023 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
1 parent
dbdc14b0e8
commit
3f4bfef607
1 file changed
+19
@@ -53,6 +53,25 @@ function nextdir() {
|
||||
}));
|
||||
}
|
||||
|
||||
// fs.mkdir creates directory with mode passed as an options object
|
||||
{
|
||||
const pathname = path.join(tmpdir.path, nextdir());
|
||||
|
||||
fs.mkdir(pathname, { mode: 0o777 }, common.mustCall(function(err) {
|
||||
assert.strictEqual(err, null);
|
||||
assert.strictEqual(fs.existsSync(pathname), true);
|
||||
}));
|
||||
}
|
||||
|
||||
// fs.mkdirSync creates directory with mode passed as an options object
|
||||
{
|
||||
const pathname = path.join(tmpdir.path, nextdir());
|
||||
|
||||
fs.mkdirSync(pathname, { mode: 0o777 });
|
||||
|
||||
assert.strictEqual(fs.existsSync(pathname), true);
|
||||
}
|
||||
|
||||
// mkdirSync successfully creates directory from given path
|
||||
{
|
||||
const pathname = path.join(tmpdir.path, nextdir());
|
||||
|
||||
Reference in new issue
Block a user