import pathlib, re, sys sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent.parent / "tools")) import build RANKING = re.compile(r"\b(best|top|recommended|cheapest|winner|better|worse|great|ideal)\b", re.I) def test_rows_have_date_link_disclaimer(): fresh, _ = build.build("2026-10-25") assert fresh for r in fresh: assert r["source_url"].startswith("https://") and r["checked_on"] and r["disclaimer"] == build.DISCLAIMER def test_hold_rows_not_exported(): fresh, _ = build.build("2026-10-25") assert not {"Upstash", "Turso", "Deno"} & {r["provider"] for r in fresh} rows = build.yaml.safe_load((build.ROOT / "data" / "rows.yaml").read_text()) assert all(r["status"] == "publish" for r in rows) assert not {"Upstash", "Turso", "Deno"} & {r["provider"] for r in rows} def test_stale_after_30_days(): fresh, stale = build.build("2026-11-25") assert not fresh and stale build.build("2026-10-25") def test_no_recommendation_language_or_affiliate(): for r in build.build("2026-10-25")[0]: assert not RANKING.search(" ".join(r.values())) assert "ref=" not in r["source_url"] and "utm_" not in r["source_url"]