Sha256: 40ac0592ac5adcc665cd70150bdaef869e634b21cffffe936d0a2580adaf7aa2
Contents?: true
Size: 1.12 KB
Versions: 19
Compression:
Stored size: 1.12 KB
Contents
'use strict'; var FsTools = require('../'); var Helper = require('./helper'); var Assert = require('assert'); var Fs = require('fs'); var SANDBOX = Helper.SANDBOX_DIR + '/mkdir'; require('vows').describe('mkdir()').addBatch({ 'when destination can be created': { topic: function () { var callback = this.callback, path = SANDBOX + '/test'; FsTools.mkdir(path, '0711', function (err) { callback(err, path); }); }, 'should create directory with requested permissions': function (err, path) { Assert.ok(!err, 'Has no errror'); var stats = Fs.statSync(path); Assert.isDirectory(stats); Assert.hasPermsMode(stats, '0711'); } }, 'when can not create directory, due to permissions of parent': { topic: function () { // TODO: Add chek if current user is root, and if so - skip test FsTools.mkdir('/FOOBAR-FS-TOOLS', this.callback); }, 'can\'t create under /etc': function (err, result) { result = result; // ugly workaround for jshint + vows Assert.instanceOf(err, Error); Assert.equal(err.code, 'EACCES'); } } }).export(module);
Version data entries
19 entries across 19 versions & 1 rubygems