A passing test can still prove nothing

작성자

카테고리:

← 피드로
DEV Community · LkSvn · 2026-07-17 개발(SW)
Cover image for A passing test can still prove nothing

LkSvn

Today I had a PostgreSQL integration test passing for the wrong reason.

The test was supposed to prove that updating a missing Company returned a successful “not found” result.

I passed an id like: company-missing

But the database column was a UUID.

PostgreSQL rejected the malformed value before Prisma could determine whether the Company existed. The repository returned a failure instead of the expected missing-record outcome.

The test still passed.

Why?

Its assertion was inside a conditional success branch. Because the result was a failure, the branch never ran. The test completed with no failing assertion.

The correction was small but important:

  • generate a valid UUID that was never inserted
  • assert the complete Result object directly
  • expect success with undefined data

That made the test exercise Prisma’s real missing-record behavior instead of an invalid-input error.

The lesson

A green test is not automatically evidence.

Check that the intended branch was reached and that the assertion could actually fail.

원문에서 계속 ↗

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다