Skip to content

Commit

Permalink
Update: Add test for not setting directory mode
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Nov 30, 2017
1 parent 3087b78 commit 79c7216
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion test/file-operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ describe('mkdirp', function() {
return;
}

var mode = parseInt('0700',8);
var mode = parseInt('0700', 8);
mkdirp(dir, mode, function(err) {
expect(err).toNotExist();

Expand All @@ -1006,6 +1006,29 @@ describe('mkdirp', function() {
});
});

it('does not change directory mode if exists and no mode given', function(done) {
if (isWindows) {
this.skip();
return;
}

var mode = parseInt('0700', 8);
mkdirp(dir, mode, function(err) {
expect(err).toNotExist();

mkdirp(dir, function(err2) {
expect(err2).toNotExist();

fs.stat(dir, function(err3, stats) {
expect(err3).toNotExist();
expect(stats.mode & MODE_MASK).toEqual(mode & ~process.umask());

done();
});
});
});
});

it('makes multiple directories with custom mode', function(done) {
if (isWindows) {
this.skip();
Expand Down

0 comments on commit 79c7216

Please sign in to comment.