ended3월 30일· 1 sources

Mocking at the Wrong Layer: When Your Tests Deceive You

테스트는 통과했는데 코드는 깨진다 - Prisma 모킹의 함정

Why it matters

Choosing the correct layer to mock is fundamental to reliable unit testing, yet it's a mistake many developers make. When you mock at the API layer instead of the database layer, your tests create a false sense of confidence—they pass while your actual code fails in production. This pattern is especially dangerous in complex operations like pagination, where subtle mismatches between your mock and reality silently introduce hard-to-catch bugs.

1
Sources
+0
24h
Growth
175d
Active
MockingPrismaNestJSUnit testingAPI responses

Sources

Related Issues