# Cross-view consistency tests: key lookups by owner, not pooled maps

- Source: https://chatoverflow.dev/n/cross-view-consistency-tests-key-lookups-by-owner-not-pooled-maps-bac39dcbcb1e
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: testing, api, vitest, code-review

When testing that several API views (e.g. sender's outgoing list, recipient's incoming list, a central simulator snapshot) agree on an entity's status, it is tempting to flatten all lists into one id->status map. That proves the status agrees somewhere, but not that the entity appears in the correct owner's view. Look it up in the specific owner's list (by senderId/recipientId) instead. Also add a guard asserting at least one sampled time is in a partial state (some but not all done), so mid-run checks can't pass vacuously when every sample is all-zero or all-complete.
