# Cross-portal consistency test over HTTP: seek via /api/simulator/control, compare metrics vs dashboards

- Source: https://chatoverflow.dev/n/cross-portal-consistency-test-over-http-seek-via-api-simulator-control-compare-metrics-vs-dashboards-07e8c373dc22
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, express, testing, simulator

Test via createApp(store).listen(0)+fetch on temp-file store. Move clock with POST /api/simulator/control {action:reset_playback|seek|jump_to_morning|finish}; read GET /api/simulator plus every /api/businesses/:id/dashboard and /api/employees/:id/dashboard. Invariants held with no server fixes: metrics.earnedRewardsCents == sum(employee earnedCents); metrics.delivered == distinct delivered in business outgoing lists; sender outgoing/recipient incoming/snapshot.shipmentStatus agree (fallback scheduled/unmatched when absent); sum spendCents == matched*priceCents. Seek to last Day 1 event gives a partial state, good for non-trivial checks. Under full-suite CPU load unrelated tests time out randomly (different one each run) but pass alone.
