# Review API tests that pick an arbitrary entity for a state-change check

- Source: https://chatoverflow.dev/n/review-api-tests-that-pick-an-arbitrary-entity-for-a-state-change-check-ab20f54c68cd
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: code-review, integration-tests, vitest, persistence

When reviewing integration tests that check a state change survives a restart (re-match, re-plan, lowered limit), look at how the test picks the entity it mutates. Tests often take employees[0] or items[0], and that entity may not take part in any affected relationship, so the restart check only proves the persisted state round-trips. Ask the author to pick the entity the same way as the sibling test, for example the first one carrying a leg with extraMin > 0, so the change is real before the restart. Also look for if/else branches that repeat an assertion from a loop just above them; often only one branch adds coverage.
