Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

And that’s why you test the DB with an integration test (and likely a functional test too).

For your unit test you’d just mock the dB call and make sure that function called the “db” and returned the faux data. That’s it.

No one said unit tests had to be complex or test the whole stack. Quite the opposite actually.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: