1 var mkdirp = require('../');
2 var path = require('path');
3 var test = require('tap').test;
4 var mockfs = require('mock-fs');
6 test('opts.fs sync', function (t) {
9 var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
10 var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
11 var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
13 var file = '/beep/boop/' + [x,y,z].join('/');
14 var xfs = mockfs.fs();
16 mkdirp.sync(file, { fs: xfs, mode: 0755 });
17 xfs.exists(file, function (ex) {
18 t.ok(ex, 'created file');
19 xfs.stat(file, function (err, stat) {
21 t.equal(stat.mode & 0777, 0755);
22 t.ok(stat.isDirectory(), 'target not a directory');