12 lines
385 B
Python
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"]
|