Skip to content
loading...

re: NodeJS - Unit Tests - testing without hitting database. Confusings. VIEW POST

FULL DISCUSSION
 

I run integration tests against a separate (empty) database. Maintaining fixtures is enough work when you don't have to worry about whether they actually reflect your current data model. Node doesn't really have a formal separation between unit and integration tests like Maven-style Java projects do so it all winds up being "just tests" anyway.

 

I'm pretty sure there is a big distinction between unit tests and integration tests, in any language, framework or paradigm.

 

With every JS test runner I've used, the way you can tell which is which is that some fail when your external dependencies aren't available.

Ah sorry, my bad, now I think I understand what you said, you meant how that framework calls them.

Basically yes, they are all automatic tests.

I replied for an abstract/conceptual level, how you write them, what they are for and when they are run (and how long they should take).

And to answer to the the post question, unit tests are not supposed ti hit any dependency, outside of that function, so it is ok. But you may want to check the other 2 types of tests

code of conduct - report abuse