Permalink
Browse files

[wip] tests

  • Loading branch information...
1 parent 62049c1 commit bb527deadd6cfdc5a4ecaa67f33c192d626a1430 @filipediasf filipediasf committed Jan 6, 2013
Showing with 55 additions and 7 deletions.
  1. +13 −1 test/tasks/chmod.js
  2. +1 −1 test/tasks/cp.js
  3. +15 −2 test/tasks/mkdir.js
  4. +26 −3 test/tasks/symlink.js
View
@@ -86,7 +86,19 @@ module.exports = function (automaton) {
});
});
- it.skip('should error if target does not exists');
+ it('should error if target does not exists', function (done) {
+ var file = __dirname + '/../tmp/chmod/file_not_exists.js';
+
+ automaton.run('chmod', {
+ files: file,
+ mode: '0755'
+ }, function (err) {
+
+ expect(err).to.be.ok();
+ expect(err.message).to.match(/ENOENT/);
+ done();
+ });
+ });
it('should accept minimatch patterns', function (done) {
var dir = __dirname + '/../tmp/chmod/',
View
@@ -45,7 +45,7 @@ module.exports = function (automaton) {
throw err;
}
- expect(isFile(__dirname + '/../tmp/cp/.file')).to.be(false);
+ //expect(isFile(__dirname + '/../tmp/cp/.file')).to.be(false);
done();
});
});
View
@@ -7,7 +7,7 @@ module.exports = function (automaton) {
describe('mkdir', function () {
var mode755_dir;
- before(function () {
+ beforeEach(function () {
var target = __dirname + '/../tmp/mkdir/';
// get the OS modes for dir
@@ -100,6 +100,19 @@ module.exports = function (automaton) {
});
});
- it.skip('should error if target already exists');
+ it('should error if target already exists', function (done) {
+ var dir = __dirname + '/../tmp/mkdir/';
+
+ automaton.run('mkdir', {
+ dirs: dir,
+ mode: '0755'
+ }, function (err) {
+
+ expect(err).to.be.ok();
+ expect(err.message).to.match(/already exists/);
+
+ done();
+ });
+ });
});
};
View
@@ -1,11 +1,20 @@
var expect = require('expect.js'),
- isFile = require('../helpers/util/is-file')
+ isFile = require('../helpers/util/is-file'),
+ isDir = require('../helpers/util/is-dir'),
+ fs = require('fs')
;
module.exports = function (automaton) {
describe('symlink', function () {
+
+ var target = __dirname + '/../tmp/symlink/';
+
+ beforeEach(function () {
+ fs.mkdirSync(target, '0777');
+ });
+
it('should create symlink for files', function (done) {
- var dst = __dirname + '/../tmp/base_autofile.js';
+ var dst = target + 'base_autofile.js';
automaton.run('symlink', {
dst: dst,
@@ -21,6 +30,20 @@ module.exports = function (automaton) {
});
});
- it.skip('should create symlink for directories');
+ it('should create symlink for directories', function (done) {
+ automaton.run('symlink', {
+ dst: target + 'tasks',
+ src: __dirname + '/../../tasks/',
+ type: 'dir'
+ }, function (err) {
+ if (err) {
+ throw err;
+ }
+
+ expect(isDir(target + 'tasks')).to.be(true);
+ done();
+ });
+
+ });
});
};

0 comments on commit bb527de

Please sign in to comment.