16 lines
526 B
Python
16 lines
526 B
Python
import json
|
|
|
|
from app.modules.notifier import append_json_event
|
|
|
|
|
|
def test_append_json_event_writes_jsonl(tmp_path):
|
|
output = tmp_path / "logs" / "events.jsonl"
|
|
|
|
append_json_event(output, {"event": "long_stay_alert", "count": 5})
|
|
append_json_event(output, {"event": "half_hour_report", "count": 3})
|
|
|
|
lines = output.read_text(encoding="utf-8").splitlines()
|
|
|
|
assert json.loads(lines[0]) == {"event": "long_stay_alert", "count": 5}
|
|
assert json.loads(lines[1]) == {"event": "half_hour_report", "count": 3}
|