What would be the best practice setup for running tests that involved some integration of a NodeJS API and a database?
In addition to unit tests, it'd be great if I could seed the database with some dummy data and test various behaviors on this data.
In these cases is it best to have a test database sitting there solely for the purpose of testing? E.g. in AWS there'd be an RDS instance always on, that CI tools would point to and have permissions for.
What I tend to do here is to create fixture objects that represent common objects I'd use to test. So a Car model might have a Camero fixture object, that I then instantiate in my unit tests to do something with.
Read this as: I create any objects I need to test with in the unit tests themselves, then make sure to delete the data after my test. I don't pre-populate the database with test objects, because I may want to create a Red Camera, or a Camero With Three Wheels Camero for some test I'm doing.
For MEAN apps in the past I've had good luck with FactoryLady. It claims it only assumes a "save" method exists on your objects, so it should be usable with some SQL ORM you're using.