mirror of
https://github.com/jprichardson/node-fs-extra.git
synced 2026-01-25 16:42:57 +00:00
test/mkdirp/umask_sync.test: 4 spaces to 2, removed semicolons, tap to assert
This commit is contained in:
parent
de933e9b13
commit
cdfe6d7d08
@ -1,30 +1,31 @@
|
||||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var exists = fs.exists || path.exists;
|
||||
var test = require('tap').test;
|
||||
var assert = require('assert')
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var fse = require('../../')
|
||||
var testutil = require('testutil')
|
||||
|
||||
test('umask sync modes', function (t) {
|
||||
t.plan(4);
|
||||
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
describe('umask sync modes', function () {
|
||||
it('should', function(done) {
|
||||
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16)
|
||||
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16)
|
||||
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16)
|
||||
|
||||
var file = '/tmp/' + [x,y,z].join('/');
|
||||
var file = testutil.createTestDir('fs-extra') + '/' + [x,y,z].join('/')
|
||||
|
||||
try {
|
||||
mkdirp.sync(file);
|
||||
fse.mkdirpSync(file)
|
||||
} catch (err) {
|
||||
t.fail(err);
|
||||
return t.end();
|
||||
return done(err)
|
||||
}
|
||||
|
||||
exists(file, function (ex) {
|
||||
t.ok(ex, 'file created');
|
||||
fs.stat(file, function (err, stat) {
|
||||
t.ifError(err);
|
||||
t.equal(stat.mode & 0777, (0777 & (~process.umask())));
|
||||
t.ok(stat.isDirectory(), 'target not a directory');
|
||||
});
|
||||
});
|
||||
});
|
||||
fs.exists(file, function (ex) {
|
||||
assert.ok(ex, 'file created')
|
||||
fs.stat(file, function (err, stat) {
|
||||
assert.ifError(err)
|
||||
assert.equal(stat.mode & 0777, (0777 & (~process.umask())))
|
||||
assert.ok(stat.isDirectory(), 'target not a directory')
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user