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

Commit

Permalink
Fixing some async tests to properly test!
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Williams committed Jun 17, 2016
1 parent cc939c8 commit d250647
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/data/timings/second/3.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function second (next) {
module.exports = function third (next) {
global.end3 = new Date().getTime()

setTimeout(function () {
Expand Down
2 changes: 1 addition & 1 deletion test/data/timings/second/4.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function second (next) {
module.exports = function fourth (next) {
global.end4 = new Date().getTime()

setTimeout(function () {
Expand Down
12 changes: 9 additions & 3 deletions test/lib/up.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,29 @@ 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 () {
it('should run database phase', function (done) {
up(['test/data/fake'], function () {
expect(global.database).to.equal(true)

done()
})
})

it('should run items in order', function () {
it('should run items in order', function (done) {
up(['test/data/timings/first'], function () {
expect(global.end1).to.be.below(global.end2)

done()
})
})

it('should run phases in order', function () {
it('should run phases in order', function (done) {
up(['test/data/timings/second', 'test/data/timings/first'], function () {
expect(global.end3).to.be.below(global.end4)
expect(global.end4).to.be.below(global.end1)
expect(global.end1).to.be.below(global.end2)

done()
})
})

Expand Down

0 comments on commit d250647

Please sign in to comment.