DEV Community

Cover image for A passing test can still prove nothing
LkSvn
LkSvn

Posted on

A passing test can still prove nothing

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.

Top comments (0)