-
Notifications
You must be signed in to change notification settings - Fork 230
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
Add API tests #227
base: master
Are you sure you want to change the base?
Add API tests #227
Conversation
This commit adds API tests, and makes some modifications to already existing logic: - Add an export called closeConnection to utils.js to allow closing thedatabase connection. This makes the test runner not get stuck, since supertest closes the server on each request, but can't close the database connection. - Make app.js and utils.js not log anything to the console if in a test environment in order to keep the test runner output intact.
Hey @MeLlamoPablo, thanks! Just one thing pops to my head now: Shouldn't we close the database connection every time the Express app closes? I mean, it has nothing to do with the tests, it should be a regular behavior. |
I don't see why not. The important thing here is not the database, IMO, it's listening to With vm this is not too much of a big deal, but with platforms like Heroku, they will restart your processes once a day, so probably a good thing to have. |
I agree. Could you do that and also move the database connection termination part to the app itself? I'll merge it afterwards. |
I'm sorry, but I'm very busy at the moment. I did this because I wanted to practise API testing (and also wanted the Hacktoberfest shirt, not gonna lie), but I can't really dedicate more time contributing here :( You'd be better off opening a separate issue and having someone else take over |
No problem @MeLlamoPablo, thank you for your contribution, it's more than enough :) |
This commit adds API tests, and makes some modifications to already existing logic:
Closes #220.