Files
LazyEnter/tests/test_hooks.py

35 lines
906 B
Python

"""hooks 모듈 테스트."""
from lazy_enter.hooks import format_notification, parse_hook_event
def test_parse_hook_event_valid():
raw = '{"type": "prompt", "tool": "Bash"}'
event = parse_hook_event(raw)
assert event["type"] == "prompt"
assert event["tool"] == "Bash"
def test_parse_hook_event_invalid():
event = parse_hook_event("not json")
assert event == {}
def test_format_notification_prompt():
event = {"type": "prompt", "tool": "Bash"}
msg = format_notification(event)
assert msg is not None
assert "승인 대기 중" in msg
def test_format_notification_completion():
event = {"type": "completion", "summary": "리팩토링 완료"}
msg = format_notification(event)
assert msg is not None
assert "완료" in msg
def test_format_notification_unknown():
event = {"type": "unknown"}
assert format_notification(event) is None