test/mkdirp/umask.test: JSS

This commit is contained in:
JP Richardson 2015-03-28 06:01:23 -05:00
parent 7360865e8a
commit 1a95eaf7fe

View File

@ -4,15 +4,15 @@ var path = require('path')
var testutil = require('../_lib/util')
var fse = require('../../')
'use strict'
/* global afterEach, beforeEach, describe, it */
var TEST_DIR = ''
var oct777 = parseInt('777', 8)
describe('mkdirp', function() {
describe('mkdirp', function () {
var _rndDir
beforeEach(function() {
beforeEach(function () {
TEST_DIR = testutil.createTestDir()
TEST_DIR = path.join(TEST_DIR, 'mkdirp')
@ -21,22 +21,23 @@ describe('mkdirp', function() {
fs.mkdirSync(TEST_DIR)
// for actual tests
var x = Math.floor(Math.random() * Math.pow(16,6)).toString(16)
var y = Math.floor(Math.random() * Math.pow(16,6)).toString(16)
var z = Math.floor(Math.random() * Math.pow(16,6)).toString(16)
var x = Math.floor(Math.random() * Math.pow(16, 6)).toString(16)
var y = Math.floor(Math.random() * Math.pow(16, 6)).toString(16)
var z = Math.floor(Math.random() * Math.pow(16, 6)).toString(16)
_rndDir = path.join(TEST_DIR, [x, y, z].join(path.sep))
// just to be safe, although unnecessary
assert(!fs.existsSync(_rndDir))
})
afterEach(function() {
afterEach(function () {
fse.removeSync(TEST_DIR)
})
describe('umask', function() {
describe('async', function() {
it('should have proper umask', function(done) {
describe('umask', function () {
describe('async', function () {
it('should have proper umask', function (done) {
fse.mkdirp(_rndDir, function (err) {
assert.ifError(err)
fs.exists(_rndDir, function (ex) {
@ -52,8 +53,8 @@ describe('mkdirp', function() {
})
})
describe('sync', function() {
it('should have proper umask', function(done) {
describe('sync', function () {
it('should have proper umask', function (done) {
try {
fse.mkdirpSync(_rndDir)
} catch (err) {