0
I have an API written in Nodejs (express) that uses the library mysql to pull data from a database hosted on AWS.
API endpoints are basically SQL queries, almost without logic associated with data return.
I would like to test this API to see if it behaves well with null, invalid fields, etc. but I don’t want to use the production database for this.
I must create a new database identical to the original, put it in the cloud and use it for testing or if there are any better suggestions?
for unit test need not database, make a mock of the database, otherwise it will not be a unit test
– Ricardo Pontual
Please explain better @Ricardopunctual how this would be done? What library? Remembering that it has almost no logic, the idea would be to test if the query is behaving as expected for different entries in the database
– André Luiz Bittencourt
if you want to test the query in the database is not a unit test. Unit test a single class, a method
– Ricardo Pontual
Okay, I’ll switch to integration testing, it’s more appropriate to the question?
– André Luiz Bittencourt