Navigation Menu

Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
logicalparadox committed Nov 13, 2012
1 parent d80d4bf commit a93e1d8
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
37 changes: 37 additions & 0 deletions test/auto.js
@@ -0,0 +1,37 @@
describe('auto', function () {
it('can run a concurrent set of dependant tasks', function (done) {
var spy1 = chai.spy('one', function (next) {
setTimeout(function () {
spy2.should.have.been.called.once;
spy3.should.have.not.been.called();
next();
}, 10);
})
, spy2 = chai.spy('two', function (next) {
setTimeout(function () {
spy1.should.have.been.called.once;
spy3.should.have.not.been.called();
next();
}, 10);
})
, spy3 = chai.spy('three', function (next) {
setTimeout(function () {
spy1.should.have.been.called.once;
spy2.should.have.been.called.once;
next();
}, 10);
});

auto({
one: spy1
, two: spy2
, three: [ 'one', 'two', spy3 ]
}, function (err) {
should.not.exist(err);
spy1.should.have.been.called.once;
spy2.should.have.been.called.once;
spy3.should.have.been.called.once;
done();
});
});
});
2 changes: 1 addition & 1 deletion test/bootstrap/index.js
Expand Up @@ -9,7 +9,7 @@ global.should = global.chai.should();
* Chai Plugins
*/

//global.chai.use(require('chai-spies'));
global.chai.use(require('chai-spies'));
//global.chai.use(require('chai-http'));

/*!
Expand Down
3 changes: 2 additions & 1 deletion test/browser/index.html
Expand Up @@ -6,6 +6,7 @@
<link rel="stylesheet" href="../../node_modules/mocha/mocha.css" />
<script src="../../node_modules/mocha/mocha.js"></script>
<script src="../../node_modules/chai/chai.js"></script>
<script src="../../node_modules/chai-spies/chai-spies.js"></script>
<script>
mocha.setup('bdd')
var should = chai.should();
Expand All @@ -14,7 +15,7 @@
<script>
auto = require('breeze-auto');
</script>
<!-- <script src="../test.js"></script> -->
<script src="../auto.js"></script>
<script>onload = function () {
if (window.mochaPhantomJS) mochaPhantomJS.run()
else mocha.run();
Expand Down

0 comments on commit a93e1d8

Please sign in to comment.