-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed tests, now they are broken #150
base: master
Are you sure you want to change the base?
Changes from all commits
e70466c
6308c5f
5455fa1
5a8fe13
b20e775
ad6f109
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"mocha": true, | ||
"esnext": true, | ||
"node": true | ||
"node": true, | ||
"expr": true | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,16 +101,15 @@ describe("FastBoot", function() { | |
}); | ||
}); | ||
|
||
it("can forcefully destroy the app instance using destroyAppInstanceInMs", function() { | ||
it("can forcefully destroy the app instance using destroyAppInstanceInMs", function(done) { | ||
var fastboot = new FastBoot({ | ||
distPath: fixture('basic-app') | ||
distPath: fixture('long-resolving-app') | ||
}); | ||
|
||
return fastboot.visit('/', { | ||
destroyAppInstanceInMs: 5 | ||
}) | ||
fastboot.visit('/', { destroyAppInstanceInMs: 5 }) | ||
.catch((e) => { | ||
expect(e.message).to.equal('App instance was forcefully destroyed in 5ms'); | ||
expect(e.message).to.equal('Fastboot forcefully destroyed App instance in 5ms'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if this expect fails, I believe an assertion is thrown preventing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test will just timeout, current timeout 1000ms I think, so it will still fail, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So why can't we just return the promise and move the assertion in the reject function? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kratiahuja because of this #150 (comment) , the whole point of this PR was not to do that, because of mentioned problems :) |
||
done(); | ||
}); | ||
}); | ||
|
||
|
@@ -158,14 +157,15 @@ describe("FastBoot", function() { | |
return expect(fastboot.visit('/')).to.be.rejected; | ||
}); | ||
|
||
it("catches the error if an error occurs", function() { | ||
it("catches the error if an error occurs", function(done) { | ||
var fastboot = new FastBoot({ | ||
distPath: fixture('rejected-promise') | ||
}); | ||
|
||
fastboot.visit('/') | ||
.catch(function(err) { | ||
return expect(err).to.be.not.null; | ||
expect(err).to.be.not.null; | ||
done(); | ||
}); | ||
}); | ||
|
||
|
@@ -344,13 +344,16 @@ describe("FastBoot", function() { | |
} | ||
}); | ||
|
||
it("handles apps boot-time failures by throwing Errors", function() { | ||
it("handles apps boot-time failures by throwing Errors", function(done) { | ||
var fastboot = new FastBoot({ | ||
distPath: fixture('boot-time-failing-app') | ||
}); | ||
|
||
return fastboot.visit('/') | ||
.catch((e) => expect(e).to.be.an('error')); | ||
fastboot.visit('/') | ||
.catch((e) => { | ||
expect(e).to.be.an('error'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it("matches app's fastboot-info and result's fastboot-info", function() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why
done
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because otherwise it is skipping assertion in catch, you can try yourself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I a bit surprised with the mocha behavior if it is right. I thought returning promise or
done
was the same in mocha.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be fixed in mocha upstream as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think since you are returning
resolved
promise it is behaving correctly, it either needs rejections insidethen
or it needs to usedone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I find https://github.com/domenic/chai-as-promised clears all this up nicely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will cleanup with next PR, using it :)