From cdfe6d7d08bfc2b7ac2c4ba1b2cf89b7a3aa108d Mon Sep 17 00:00:00 2001 From: JP Richardson Date: Tue, 9 Dec 2014 04:34:03 -0600 Subject: [PATCH] test/mkdirp/umask_sync.test: 4 spaces to 2, removed semicolons, tap to assert --- test/mkdirp/umask_sync.test.js | 47 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/test/mkdirp/umask_sync.test.js b/test/mkdirp/umask_sync.test.js index 3211d94..7f6fd13 100644 --- a/test/mkdirp/umask_sync.test.js +++ b/test/mkdirp/umask_sync.test.js @@ -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'); - }); - }); -}); \ No newline at end of file + 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() + }) + }) + }) +}) \ No newline at end of file