"""task-watcher heartbeat payload — state=mode + mode 필드 검증."""
import json

from _shared.heartbeat import build_payload, WorkerStats


def test_watcher_heartbeat_payload_carries_mode():
    payload = json.loads(
        build_payload(
            "task-watcher", "watcher", "trading",
            WorkerStats(), extra={"mode": "trading"},
        )
    )
    assert payload["kind"] == "watcher"
    assert payload["state"] == "trading"
    assert payload["mode"] == "trading"
