Skip to content

Commit

Permalink
Add init test.
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffano committed Feb 14, 2013
1 parent 56539ab commit b9d903c
Showing 1 changed file with 16 additions and 47 deletions.
63 changes: 16 additions & 47 deletions test/ae86.js
Original file line number Original file line Diff line number Diff line change
@@ -1,53 +1,22 @@
/* var AE86 = require('../lib/ae86'),
var bag = require('bagofholding'), buster = require('buster'),
_jscov = require('../lib/ae86'), ncp = require('ncp');
sandbox = require('sandboxed-module'),
should = require('should'), buster.testCase('ae86 - init', {
checks, mocks, 'should delegate to ncp ncp when initialising the project': function (done) {
ae86; this.stub(ncp, 'ncp', function (source, dest, cb) {
assert.isTrue(source.match(/.+\/ae86\/examples$/).length === 1);
describe('ae86', function () { assert.equals(dest, '.');
cb();
function create(checks, mocks) { });
return sandbox.require('../lib/ae86', { var ae86 = new AE86();
requires: mocks ? mocks.requires : {}, ae86.init(function (err, result) {
globals: { done();
console: bag.mock.console(checks, mocks),
process: bag.mock.process(checks, mocks)
},
locals: {
__dirname: '/somepath/ae86/lib'
}
}); });
} }
});


beforeEach(function () { /*
checks = {};
mocks = {};
});
describe('init', function () {
it('should delegate to ncp ncp when initialising the project', function (done) {
mocks.requires = {
ncp: {
ncp: function (srcDir, destDir, cb) {
checks.ncp_ncp_srcDir = srcDir;
checks.ncp_ncp_destDir = destDir;
cb();
}
}
};
ae86 = new (create(checks, mocks))();
ae86.init(function (err, result) {
done();
});
checks.ncp_ncp_srcDir.should.equal('/somepath/ae86/examples');
checks.ncp_ncp_destDir.should.equal('.');
checks.console_log_messages.length.should.equal(1);
checks.console_log_messages[0].should.equal('Creating example AE86 project');
});
});
describe('generate', function () { describe('generate', function () {
Expand Down

0 comments on commit b9d903c

Please sign in to comment.