1 var mkdirp = require('../').mkdirp;
2 var path = require('path');
3 var fs = require('fs');
4 var test = require('tap').test;
5 var _0777 = parseInt('0777', 8);
6 var _0755 = parseInt('0755', 8);
7 var _0744 = parseInt('0744', 8);
9 var ps = [ '', 'tmp' ];
11 for (var i = 0; i < 25; i++) {
12 var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
16 var file = ps.join('/');
18 test('chmod-pre', function (t) {
20 mkdirp(file, mode, function (er) {
21 t.ifError(er, 'should not error');
22 fs.stat(file, function (er, stat) {
23 t.ifError(er, 'should exist');
24 t.ok(stat && stat.isDirectory(), 'should be directory');
25 t.equal(stat && stat.mode & _0777, mode, 'should be 0744');
31 test('chmod', function (t) {
33 mkdirp(file, mode, function (er) {
34 t.ifError(er, 'should not error');
35 fs.stat(file, function (er, stat) {
36 t.ifError(er, 'should exist');
37 t.ok(stat && stat.isDirectory(), 'should be directory');