Files
laya-hook/tests/test_feed.py
richarjiang eae4df7d51 init
2026-09-24 10:04:41 +08:00

12 lines
385 B
Python

import json
from laya_router.feed import read_routes
def test_read_routes_keeps_the_tail(tmp_path):
path = tmp_path / "routes.jsonl"
lines = [json.dumps({"ts": str(i), "level": "simple"}) for i in range(5)]
path.write_text("\n".join(lines) + "\nbad\n", encoding="utf-8")
records = read_routes(path, limit=2)
assert [item["ts"] for item in records] == ["3", "4"]