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

Could you elaborate on why you find a real DB overkill for testing purposes?

Typically you would have a set of unit tests which test your code only and use mocks for external dependencies, in this case you would mock Prisma.

Tests involving DB state are not unit tests anymore and require a bit more setup but most frameworks provide a test harness/runner to quickly spin up a part of your app with dependencies resolved (instead of mocked) so you can call controller/handler/service methods directly and verify their behavior.

The boilerplate for this should mostly be limited to switching out an environment variable for the database connection and maybe setup some fixtures. Is this not possible in Prisma?



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: