by ericHosick · 4y ago · 0 comments
Unit testing seems to depend on where the unit of code is which is being tested. At the middle tier, you may mock out parts of the code so the tests aren't reliant on external sources (apis, databases, libraries, etc.).
It seems that unit testing database code would happen at the database layer: it's still a unit test as the test isn't dependent on external sources.
Its not database code though. "Orders over 100$ should be marked as vip" is domain logic.
Database code like interactions with database, connection pools, primary/secondary switching ect yes they should be tested with a database.