-
Notifications
You must be signed in to change notification settings - Fork 2k
Updating User model tests for synchronous test and fixing done() calls #768
Conversation
@@ -153,6 +150,8 @@ describe('User Model Unit Tests:', function () { | |||
}); | |||
|
|||
after(function (done) { | |||
User.remove().exec(done); | |||
User.remove().exec(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.
I believe you can just do User.remove().exec(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.
you're right but I noticed some odd inconsistency with the after() call failing sometimes and wasn't sure if it is attributed to that or not.
WDYT?
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.
When doing User.remove().exec(done);
, the after()
would fail? That seems weird..I've never run into that issue and it's not like something crazy is happening. Does it work consistently in other callbacks? What about in the afterEach()
below?
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.
not consistently unfortunately :(
I don't mind returning to the original .exec(done)
and let's keep an eye really close on tests, there is a lot more work required there to get the testing automation safety-net to be really bullet proof.
Ok with you?
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.
Yeah sounds good. Are you going to change it in the routes afterEach 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.
Yeah, if we change the convention to just .exec(done)
then I'll change it back as it was to be consistent.
…ocha 2 second timeouts causing travis-ci build fails
2363371
to
c967a98
Compare
@ilanbiala I updated and squashed, this should solve still the async/sync issue with that one test. |
LGTM |
Thanks, I'll merge. |
Updating User model tests for synchronous test and fixing done() calls
refactoring the async nature in the user model tests to account for mocha 2 second timeouts causing travis-ci build fails