-
Notifications
You must be signed in to change notification settings - Fork 13
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
Fix: clean up getConnection() test properly #29
base: master
Are you sure you want to change the base?
Conversation
@@ -24,6 +24,10 @@ describe('Connectable ::', function() { | |||
}); | |||
}); | |||
|
|||
after(function(done) { | |||
manager.pool.end(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.
Should we use the mp-postgresql destroyManager
method for this?
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.
Up to 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.
Thinking about this more, I think the above approach is preferable to using the library under test for cleanup.
assert(report.connection.release); | ||
// Assert that the connection has a release function, and call it to | ||
// release the connection. | ||
report.connection.release(); |
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.
Should we keep the assert
here?
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.
Does it add value? If report.connection.release
is not defined, then this line will throw anyway.
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.
Fair point, but I'd like to keep this PR to just the minimal set of changes needed for the fix
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.
assert(report.connection.release); | ||
// Assert that the connection has a release function, and call it to | ||
// release the connection. | ||
report.connection.release(); |
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.
So your preference would be something like below?
// Assert that the connection has a release function
assert(report.connection.release);
// Call the release function on the connection to release the connection
report.connection.release();
This fix for balderdashy/sails#6908 will allow
mocha
to be updated to the latest version.