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:
parent
ce58b7d65e
commit
e89a60c45c
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
module.exports = function(app, cb) {
|
||||
if (app.booting)
|
||||
process.bootingFlagSet = true;
|
||||
|
||||
process.nextTick(cb);
|
||||
};
|
Loading…
Reference in New Issue