I am looking to write unit and/or integration tests for one of the projects that I work on. I connect to mongo and postgres(using plain drivers, no ORM frameworks on top like mongoose or knex). I use express for web services.
I don't use any kind of ORM
So, now that I have my stack explained, I would like some suggestions on how to implement the unit tests.
I have written unit & integration tests in java quite some time back but I have no experience for the same in node.js. I used to have a mock data feed which is used to mimic the database. It uses the
h2 database(an in memory database which is created along with tests and dies after the test cycle, magically!!).
Now, I am not sure if I can do something similar in node.js. I do want to have an approach like this because, I write my own raw sql queries. Right now, there is no plan to move it to an ORM as we have lot of custom logic that happens inside. So, is there a way or someone has implemented something similar in typescript?