filer/tests/spec/node-js/simple/test-fs-mkdir.js

40 lines
1.2 KiB
JavaScript
Raw Normal View History

2014-05-23 20:53:50 +00:00
var util = require('../../../lib/test-utils.js');
var expect = require('chai').expect;
2013-11-27 17:18:09 +00:00
2014-05-23 20:53:50 +00:00
describe("node.js tests: https://github.com/joyent/node/blob/master/test/simple/test-fs-mkdir.js", function() {
beforeEach(util.setup);
afterEach(util.cleanup);
2013-11-27 17:18:09 +00:00
2014-05-23 20:53:50 +00:00
// Based on test1 from https://github.com/joyent/node/blob/master/test/simple/test-fs-mkdir.js
it('should create a dir without a mode arg', function(done) {
var pathname = '/test1';
var fs = util.fs();
2013-11-27 17:18:09 +00:00
2014-05-23 20:53:50 +00:00
fs.mkdir(pathname, function(error) {
if(error) throw error;
fs.stat(pathname, function(error, result) {
expect(error).not.to.exist;
expect(result).to.exist;
expect(result.type).to.equal('DIRECTORY');
done();
2013-11-27 17:18:09 +00:00
});
});
2014-05-23 20:53:50 +00:00
});
2013-11-27 17:18:09 +00:00
2014-05-23 20:53:50 +00:00
// Based on test2 https://github.com/joyent/node/blob/master/test/simple/test-fs-mkdir.js
it('should create a dir with a mode arg', function(done) {
var pathname = '/test2';
var fs = util.fs();
2014-05-23 20:53:50 +00:00
fs.mkdir(pathname, 511 /*=0777*/, function(error) {
if(error) throw error;
fs.stat(pathname, function(error, result) {
expect(error).not.to.exist;
expect(result).to.exist;
expect(result.type).to.equal('DIRECTORY');
done();
2013-11-27 17:18:09 +00:00
});
});
});
});