diff --git a/apps.html b/apps.html index ea463a3a..aaf7512e 100644 --- a/apps.html +++ b/apps.html @@ -1424,7 +1424,15 @@
Pick one thing you want to finish today. If you need more choices, search all published apps or explore daily habit apps.
Pick one thing you want to finish today. If you need more choices, search all published apps or explore daily habit apps.
diff --git a/guides/decision-helpers/index.html b/guides/decision-helpers/index.html index 39458499..fa2bafef 100644 --- a/guides/decision-helpers/index.html +++ b/guides/decision-helpers/index.html @@ -73,7 +73,7 @@Pick one thing you want to finish today. If you need more choices, search all published apps or explore quick mobile games.
Pick one thing you want to finish today. If you need more choices, search all published apps or explore quick mobile games.
diff --git a/scripts/test_guide_catalog_links.py b/scripts/test_guide_catalog_links.py new file mode 100644 index 00000000..d0a7e63c --- /dev/null +++ b/scripts/test_guide_catalog_links.py @@ -0,0 +1,44 @@ +"""Offline source checks for editorial-guide category deep links.""" +from pathlib import Path +import re +import unittest + +ROOT = Path(__file__).resolve().parent.parent +GUIDES = { + "quick-games": "quick-games", + "daily-habits": "habits", + "decision-helpers": "decisions", + "ai-tools": "ai", +} + + +class GuideCatalogDeepLinkTests(unittest.TestCase): + def test_category_links_are_consistent(self): + for slug, goal in GUIDES.items(): + with self.subTest(guide=slug): + text = (ROOT / "guides" / slug / "index.html").read_text(encoding="utf-8") + self.assertEqual(text.count(f'href="/apps?goal={goal}"'), 1) + self.assertIn('href="/apps"', text) # unfiltered breadcrumb remains available + + def test_catalog_reads_only_allowlisted_goals(self): + catalog = (ROOT / "apps.html").read_text(encoding="utf-8") + self.assertIn("new URLSearchParams(window.location.search).get('goal')", catalog) + self.assertIn("['quick-games', 'habits', 'decisions', 'ai'].includes(requestedGoal)", catalog) + self.assertIn("button.dataset.goal === goal", catalog) + self.assertIn("render();", catalog) + self.assertNotIn("utm_source=window.location.search", catalog) + + def test_catalog_filter_buttons_cover_guides(self): + catalog = (ROOT / "apps.html").read_text(encoding="utf-8") + for goal in GUIDES.values(): + with self.subTest(goal=goal): + self.assertIn(f'data-goal="{goal}"', catalog) + + def test_catalog_cards_and_details_preserved(self): + catalog = (ROOT / "apps.html").read_text(encoding="utf-8") + self.assertEqual(len(re.findall(r'class="app-card"', catalog)), 92) + self.assertEqual(len(re.findall(r'data-detail-app="', catalog)), 5) + + +if __name__ == "__main__": + unittest.main()