merge origin/main into pr-1039, adopt HEARTBEAT_OK in-check and on_notify

This commit is contained in:
Re-bin
2026-02-23 13:57:28 +00:00
23 changed files with 281 additions and 348 deletions

View File

@@ -3,19 +3,23 @@ import asyncio
import pytest
from nanobot.heartbeat.service import (
HEARTBEAT_OK_TOKEN,
HeartbeatService,
_is_heartbeat_ok_response,
)
def test_heartbeat_ok_response_requires_exact_token() -> None:
assert _is_heartbeat_ok_response("HEARTBEAT_OK")
assert _is_heartbeat_ok_response("`HEARTBEAT_OK`")
assert _is_heartbeat_ok_response("**HEARTBEAT_OK**")
def test_heartbeat_ok_detection() -> None:
def is_ok(response: str) -> bool:
return HEARTBEAT_OK_TOKEN in response.upper()
assert not _is_heartbeat_ok_response("HEARTBEAT_OK, done")
assert not _is_heartbeat_ok_response("done HEARTBEAT_OK")
assert not _is_heartbeat_ok_response("HEARTBEAT_NOT_OK")
assert is_ok("HEARTBEAT_OK")
assert is_ok("`HEARTBEAT_OK`")
assert is_ok("**HEARTBEAT_OK**")
assert is_ok("heartbeat_ok")
assert is_ok("HEARTBEAT_OK.")
assert not is_ok("HEARTBEAT_NOT_OK")
assert not is_ok("all good")
@pytest.mark.asyncio