Sha256: 2a3db2dd8f7f1d4ca49c31c7deb3352bc058518e49b7947394e620b7e3060508

Contents?: true

Size: 1.5 KB

Versions: 19

Compression:

Stored size: 1.5 KB

Contents

'use strict';


var FsTools = require('../');
var Helper = require('./helper');
var Assert = require('assert');

var SANDBOX = Helper.SANDBOX_DIR + '/remove-sync';

require('vows').describe('removeSync()').addBatch({
  'removing single file': {
    topic: function () {
      try {
        FsTools.removeSync(SANDBOX + '/foo/bar/baz/file');
        this.callback(null);
      } catch (err) {
        this.callback(err);
      }
    },
    'removes exactly one file': function (err) {
      Assert.ok(!err, 'Has no error');
      Assert.pathNotExists(SANDBOX + '/foo/bar/baz/file');
      Assert.pathExists(SANDBOX + '/foo/bar/baz');
      Assert.pathExists(SANDBOX);
    }
  },

  'removing symbolic link': {
    topic: function () {
      try {
        FsTools.removeSync(SANDBOX + '/foo/bar/baz/link');
        this.callback(null);
      } catch (err) {
        this.callback(err);
      }
    },
    'removes symbolic link, and not the file/dir it points to': function (err) {
      Assert.ok(!err, 'Has no error');
      Assert.pathNotExists(SANDBOX + '/foo/bar/baz/link');
      Assert.pathExists(SANDBOX + '/foo/bar/baz');
      Assert.pathExists(SANDBOX);
    }
  }
}).addBatch({
  'removing directory': {
    topic: function () {
      try {
        FsTools.removeSync(SANDBOX);
        this.callback(null);
      } catch (err) {
        this.callback(err);
      }
    },
    'removes directory recursively': function (err) {
      Assert.ok(!err, 'Has no error');
      Assert.pathNotExists(SANDBOX);
    }
  }
}).export(module);

Version data entries

19 entries across 19 versions & 1 rubygems

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