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

Version Path
ela-4.1.6 node_modules/fs-tools/test/mkdir-test.js
ela-4.1.5 node_modules/fs-tools/test/mkdir-test.js
ela-4.1.4 node_modules/fs-tools/test/mkdir-test.js
ela-4.1.3 node_modules/fs-tools/test/mkdir-test.js
ela-4.1.2 node_modules/fs-tools/test/mkdir-test.js
ela-4.1.1 node_modules/fs-tools/test/mkdir-test.js
ela-4.1.0 node_modules/fs-tools/test/mkdir-test.js
ela-4.0.0 node_modules/fs-tools/test/mkdir-test.js
ela-3.4.3 node_modules/fs-tools/test/mkdir-test.js
ela-3.4.2 node_modules/fs-tools/test/mkdir-test.js
ela-3.4.0 node_modules/fs-tools/test/mkdir-test.js
ela-3.3.1 node_modules/fs-tools/test/mkdir-test.js
ela-3.3.0 node_modules/fs-tools/test/mkdir-test.js
ela-3.2.0 node_modules/fs-tools/test/mkdir-test.js
ela-3.1.1 node_modules/fs-tools/test/mkdir-test.js
ela-3.1.0 node_modules/fs-tools/test/mkdir-test.js
ela-3.0.0 node_modules/fs-tools/test/mkdir-test.js
ela-2.0.0 node_modules/fs-tools/test/mkdir-test.js
ela-1.1.0 node_modules/fs-tools/test/mkdir-test.js