Created
May 5, 2012 16:12
-
-
Save tommedema/2603686 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('should'); | |
var EventEmitter2 = require('eventemitter2').EventEmitter2 | |
bootutil = require('../src/boot/util'); | |
describe('boot util', function() { | |
it('should load existing test routines without mediator', function() { | |
bootutil.loadRoutines(__dirname + '/testroutines-nomediator', function(err, routines) { | |
err.should.not.exist(); | |
routines.should.be.an.instanceof(Array); | |
routines.should.have.lengthOf(2); | |
global.TESTROUTINELOADED.should.be.true; | |
global.TESTROUTINELOADEDRECURSIVELY.should.be.true; | |
}); | |
}), | |
it('should load existing test routines with working mediator', function() { | |
var mediator = new EventEmitter2({ | |
wildcard: false | |
}), | |
loadedone = false, | |
loadedtwo = false; | |
mediator.once('testroutineloaded', function() { | |
loadedone = true; | |
}); | |
mediator.once('testsubroutineloaded', function() { | |
loadedtwo = true; | |
}); | |
bootutil.loadRoutines(__dirname + '/testroutines', mediator, function(err, routines) { | |
err.should.not.exist(); | |
routines.should.be.an.instanceof(Array); | |
routines.should.have.lengthOf(2); | |
global.TESTROUTINELOADED.should.be.true; | |
global.TESTROUTINELOADEDRECURSIVELY.should.be.true; | |
loadedone.should.be.true; | |
loadedtwo.should.be.true; | |
throw "HEY MOCHA I SHOULD MAKE YOU FAIL BUT YOU DONT. WHY NOT? MULTIPLE ASYNC CALLBACKS DUE TO MEDIATOR???" | |
}); | |
}) | |
/* | |
it('should return error on nonexisting folder', function() { | |
bootutil.loadRoutines(__dirname + '/idonotexist', function(err, routines) { | |
err.should.exist(); | |
routines.should.not.exist(); | |
}); | |
}) | |
*/ | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment