Skip to content
This repository has been archived by the owner on Mar 1, 2021. It is now read-only.

Commit

Permalink
Add tests for async/non-async items
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Williams committed Jun 17, 2016
1 parent d118028 commit 0092624
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 1 addition & 3 deletions test/data/fake/database.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module.exports = function database (next) {
module.exports = function database () {
global.database = true

return next()
}
7 changes: 7 additions & 0 deletions test/data/fake/endpoints.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = function endpoints (next) {
setTimeout(function () {
global.endpoints = true

return next()
}, 50)
}
6 changes: 5 additions & 1 deletion test/lib/up.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var up = require('../../lib/up')
describe('microboot/lib/up', function () {
beforeEach(function () {
global.database = false
global.endpoints = false
global.end1 = false
global.end2 = false
global.end3 = false
Expand Down Expand Up @@ -40,9 +41,12 @@ describe('microboot/lib/up', function () {
expect(up.bind(up, ['test/data/fake', 'na'])).to.throw('no such file or directory')
})

it('should run database phase', function (done) {
it('should run database and endpoints phase', function (done) {
this.slow(200)

up(['test/data/fake'], function () {
expect(global.database).to.equal(true)
expect(global.endpoints).to.equal(true)

done()
})
Expand Down

0 comments on commit 0092624

Please sign in to comment.