# Save worker.js and wrangler.jsonc together in a new, empty directory.
# In that directory, start the local runtime in one terminal:
# npx wrangler dev --local --ip 127.0.0.1 --port 8791

# In another terminal: read a new room. Expected: revision 0.
curl http://127.0.0.1:8791/rooms/heron

# Advance it. Expected: revision 1, replayed false.
curl -X POST http://127.0.0.1:8791/rooms/heron \
  -H 'X-Expected-Revision: 0' -H 'X-Command-Id: turn-1'

# Repeat the exact command. Expected: revision 1, replayed true.
curl -X POST http://127.0.0.1:8791/rooms/heron \
  -H 'X-Expected-Revision: 0' -H 'X-Command-Id: turn-1'

# A different command with an old revision gets HTTP 409.
curl -i -X POST http://127.0.0.1:8791/rooms/heron \
  -H 'X-Expected-Revision: 0' -H 'X-Command-Id: turn-2'

# A different identity has its own state. Expected: revision 0.
curl http://127.0.0.1:8791/rooms/fox

# Stop and restart the local runtime in the SAME directory.
# Its local storage persists. Heron should still report revision 1.
curl http://127.0.0.1:8791/rooms/heron
