Thursday, 30 July 2020

Mocking the Database in Unit Tests - WHY ?

Given that I'm fairly new to server side testing, I've read that you usually want to mock the db for unit tests, and my reaction is: why in the world would I ever want to do that ? Building a query for the db that actually works is a huge (if not the MAIN) part of the server side (especially in node, since it's not calculation heavy), and I make use of it in pretty much 95% of the requests probably.So why ? That would make tests pointless as they would just be testing that my mock responds well to queries (which doesn't make sense). What am I missing ?

Submitted July 30, 2020 at 08:10AM by Mautriz

No comments:

Post a Comment