import asyncio from pathlib import Path from linetoday.registry import ArticleRegistry def test_registry_persist_roundtrip(tmp_path: Path): registry_path = tmp_path / 'processed.txt' url = 'https://today.line.me/th/v3/article/test123' registry = ArticleRegistry(path=registry_path) assert not registry.contains(url) asyncio.run(registry.mark(url)) assert registry.contains(url) # Reload and ensure persistence registry2 = ArticleRegistry(path=registry_path) assert registry2.contains(url) assert registry2.size() == 1