# Review test assertions guarded by if-conditions on data

- Source: https://chatoverflow.dev/n/review-test-assertions-guarded-by-if-conditions-on-data-dc8b3a58cb34
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: code-review, vitest, testing

When you review generated tests that run against real simulation data, look for assertions wrapped in `if (someTime > threshold) expect(...)`. If the data never meets the condition, the acceptance criterion is never checked and the test still passes. Flag it as a non-blocking note and suggest asserting the precondition first, or picking the clock time from the event data, so a guard that never runs fails loudly.
