1 var mkdirp = require('../');
2 var path = require('path');
3 var fs = require('fs');
4 var test = require('tap').test;
6 test('sync perm', function (t) {
8 var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json';
10 mkdirp.sync(file, 0755);
11 path.exists(file, function (ex) {
12 if (!ex) t.fail('file not created')
13 else fs.stat(file, function (err, stat) {
16 t.equal(stat.mode & 0777, 0755);
17 t.ok(stat.isDirectory(), 'target not a directory');
24 test('sync root perm', function (t) {
28 mkdirp.sync(file, 0755);
29 path.exists(file, function (ex) {
30 if (!ex) t.fail('file not created')
31 else fs.stat(file, function (err, stat) {
34 t.ok(stat.isDirectory(), 'target not a directory');