-
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?
Changes from 1 commit
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 |
---|---|---|
|
@@ -24,6 +24,10 @@ describe('Connectable ::', function() { | |
}); | ||
}); | ||
|
||
after(function(done) { | ||
manager.pool.end(done); | ||
}); | ||
|
||
it('should successfully return a PG Client instance', function(done) { | ||
Pack.getConnection({ | ||
manager: manager | ||
|
@@ -39,8 +43,9 @@ describe('Connectable ::', function() { | |
// Assert that a PG Client is returned | ||
assert(report.connection instanceof pg.Client); | ||
|
||
// Assert that the connection has a release function | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Should we keep the 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. Does it add value? If 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. 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 commentThe reason will be displayed to describe this comment to others. Learn more. So your preference would be something like below?
|
||
|
||
return 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.