From 71c5ccfc8a4c9fa2ec965eb866fed1afef342ccf Mon Sep 17 00:00:00 2001 From: JP Richardson Date: Sat, 28 Mar 2015 06:05:30 -0500 Subject: [PATCH] JSS --- test/mkdirp/root.test.js | 12 +++++++----- test/mkdirp/sync.test.js | 20 ++++++++++++-------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/test/mkdirp/root.test.js b/test/mkdirp/root.test.js index 4743fbf..3f38e95 100644 --- a/test/mkdirp/root.test.js +++ b/test/mkdirp/root.test.js @@ -2,15 +2,17 @@ var assert = require('assert') var fs = require('fs') var path = require('path') var fse = require('../../') -var testutil = require('testutil') -describe('mkdirp / root', function () { +/* global describe, it */ + +var o755 = parseInt('755', 8) - it('should', function(done) { +describe('mkdirp / root', function () { + it('should', function (done) { // '/' on unix, 'c:/' on windows. var file = path.resolve('/') - fse.mkdirp(file, 0755, function (err) { + fse.mkdirp(file, o755, function (err) { if (err) throw err fs.stat(file, function (er, stat) { if (er) throw er @@ -19,4 +21,4 @@ describe('mkdirp / root', function () { }) }) }) -}) \ No newline at end of file +}) diff --git a/test/mkdirp/sync.test.js b/test/mkdirp/sync.test.js index 883db23..afa99b5 100644 --- a/test/mkdirp/sync.test.js +++ b/test/mkdirp/sync.test.js @@ -1,19 +1,23 @@ var assert = require('assert') var fs = require('fs') -var path = require('path') var fse = require('../../') var testutil = require('testutil') -describe('mkdirp / sync', function() { +/* global describe, it */ + +var o755 = parseInt('755', 8) +var o777 = parseInt('777', 8) + +describe('mkdirp / sync', 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 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 = testutil.createTestDir('fs-extra') + '/' + [x,y,z].join('/') + var file = testutil.createTestDir('fs-extra') + '/' + [x, y, z].join('/') try { - fse.mkdirpSync(file, 0755) + fse.mkdirpSync(file, o755) } catch (err) { assert.fail(err) } @@ -22,7 +26,7 @@ describe('mkdirp / sync', function() { assert.ok(ex, 'file created') fs.stat(file, function (err, stat) { assert.ifError(err) - assert.equal(stat.mode & 0777, 0755) + assert.equal(stat.mode & o777, o755) assert.ok(stat.isDirectory(), 'target not a directory') done() })