Allow /stop without target argument

This commit is contained in:
2026-02-17 06:17:36 +09:00
parent 48c79c88c8
commit fa2dc0f295
4 changed files with 35 additions and 18 deletions

View File

@@ -111,7 +111,7 @@ def test_start_command_normalizes_target(monkeypatch) -> None:
assert called == [("start", "claude", "C1")]
def test_stop_command_routes_target_from_text(monkeypatch) -> None:
def test_stop_command_ignores_target_text(monkeypatch) -> None:
handler = _build_handler(monkeypatch)
called = _capture_commands(handler)
@@ -121,7 +121,21 @@ def test_stop_command_routes_target_from_text(monkeypatch) -> None:
{"user_id": "U1", "channel_id": "C1", "text": "claude"},
)
assert called == [("stop", "claude", "C1")]
assert called == [("stop", "", "C1")]
def test_stop_command_without_target_routes_immediately(monkeypatch) -> None:
handler = _build_handler(monkeypatch)
called = _capture_commands(handler)
stop_handler = handler.app.command_handlers["/stop"]
stop_handler(
lambda: None,
{"user_id": "U1", "channel_id": "C1", "text": ""},
)
assert called == [("stop", "", "C1")]
assert handler.app.client.messages == []
def test_invalid_target_sends_warning_message(monkeypatch) -> None: