Sunday, 29 April 2018

How to Unit test DAO layers in Node in 2018?

I've asked this before, and never got a great answer. I'm hoping things have improved since but I'm not sure...Are there any recommended ways to test the Dao layer of a project? And especially in a way that a) is easily done on a new clean system, and especially on a CI system such as Travis, and b) that allows for each test to be distinct from the others, so there are no data dependencies between tests. However, because I'm using postgres I need some way to get the correct schema set up as well.In the past I've done this in Java using an embeddable database, and then code to empty the tables between tests.What I'm curious about is if there is a good way to do this in node? I'm suspecting the answer will be something including Docker but I'm not sure if there's anything better?Cheers

Submitted April 29, 2018 at 05:41PM by sazzer

No comments:

Post a Comment