Add unit test to verify `app.booting flag status

- Ensure `app.booting` is initially `undefined`
- Ensure `app.booting` is set to true during boot execution
- Ensure `app.booting` is set to false upon boot completion
This commit is contained in:
Simon Ho 2015-02-20 13:50:41 -08:00
parent ce58b7d65e
commit e89a60c45c
2 changed files with 10 additions and 3 deletions

View File

@ -53,11 +53,12 @@ describe('executor', function() {
});
describe('when booting', function() {
it('should set the booting status', function(done) {
it('should set the `booting` flag during execution', function(done) {
expect(app.booting).to.be.undefined();
boot.execute(app, dummyInstructions, function(err) {
boot.execute(app, simpleAppInstructions(), function(err) {
expect(err).to.be.undefined();
expect(app.booting).to.be.false();
expect(process.bootingFlagSet).to.be.ok();
expect(app.booting).to.not.be.ok();
done();
});
});

View File

@ -0,0 +1,6 @@
module.exports = function(app, cb) {
if (app.booting)
process.bootingFlagSet = true;
process.nextTick(cb);
};