launchmaxxing/tests/test_catalog.py
caelum0x 6908fb66af feat: catalog to 82 directories, dashboard/serve, dogfood, interactive init, outreach send, portfolio, content/pain-point expansion, watch, multi-competitor backlinks, compare, directory export
Round 1 of 3 against STRATEGY-2026-10-23.md's backlog. Highlights:

- catalog.py: 24 -> 82 live-verified directories across AI-tool/GEO,
  browser-extension, API-marketplace, newsletter-sponsor, Slack/Discord
  community, and vertical-SaaS categories; export_csv/json/opml.
- dashboard.py + `dashboard`/`serve` commands: self-contained HTML dashboard
  (inline SVG progress rings, submission timeline) and a localhost-only live
  server; `report --html`/`--json` reuse the same payload.
- dogfood.py + `dogfood`: runs content generation against launchmaxxing's own
  profile for its six not-yet-submitted directories, writing evidence to
  launch-evidence/ and recording tracker state.
- init --interactive: step-by-step onboarding wizard, saves a per-product
  default profile so content/outreach no longer need every flag re-supplied.
- outreach.py: `outreach send <contact_id>` sends via the user's own SMTP
  creds and records sent_at/send_status; outreach list now prints contact
  ids so send/status are actually usable from the CLI.
- portfolio.py + `portfolio`: cross-product rollup (directories, checklist,
  outreach, last-active) across every tracked product.
- content.py: five new generators (indie_hackers, ask_hn, cold_pitch_email,
  community_intro, newsletter_sponsor_pitch), 5 -> 10 platforms.
- painpoints.py: merges Reddit with free-keyless Hacker News (Algolia) search
  and an honest Indie Hackers blocked-source report.
- watch.py + `watch`: background poll + native macOS notification on newly
  dead directories or newly stale outreach contacts.
- backlinks.py: multi-competitor `--competitors file.txt --export csv` mode.
- checklist.py: cold_outreach and reddit_pain_points now auto-derive from
  real outreach/pain-point state, not just launch_everywhere.
- compare.py + `compare`: regenerable competitor comparison table instead of
  hand-written prose.

214/214 tests pass, ruff clean on touched files. Verified every command above
by actually running it against scratch state/db files this round.
2026-10-23 14:45:17 +03:00

99 lines
3.9 KiB
Python

from __future__ import annotations
from launchmaxxing import catalog
def test_platform_count_and_shape() -> None:
assert len(catalog.PLATFORMS) == 82
for p in catalog.PLATFORMS:
assert p["id"] and p["name"] and p["url"].startswith("https://")
assert isinstance(p["categories"], tuple) and p["categories"]
assert p["note"]
assert isinstance(p["account_free"], bool)
def test_platform_by_id_matches_platforms() -> None:
assert set(catalog.PLATFORM_BY_ID) == {p["id"] for p in catalog.PLATFORMS}
assert catalog.PLATFORM_BY_ID["product_hunt"]["name"] == "Product Hunt"
def test_platforms_for_category_none_returns_all() -> None:
assert catalog.platforms_for_category(None) == catalog.PLATFORMS
assert catalog.platforms_for_category("") == catalog.PLATFORMS
def test_platforms_for_category_filters() -> None:
ai_platforms = catalog.platforms_for_category("ai")
assert ai_platforms
assert all("ai" in p["categories"] for p in ai_platforms)
assert len(ai_platforms) < len(catalog.PLATFORMS)
def test_platforms_for_category_is_case_insensitive() -> None:
assert catalog.platforms_for_category("AI") == catalog.platforms_for_category("ai")
def test_platforms_for_category_unknown_returns_empty() -> None:
assert catalog.platforms_for_category("not-a-real-category") == ()
def test_playbook_has_ten_steps() -> None:
assert len(catalog.PLAYBOOK_STEPS) == 10
keys = [s["key"] for s in catalog.PLAYBOOK_STEPS]
assert len(set(keys)) == 10
assert keys[0] == "launch_everywhere"
def test_step_by_key_matches_playbook() -> None:
assert set(catalog.STEP_BY_KEY) == {s["key"] for s in catalog.PLAYBOOK_STEPS}
def test_all_categories_sorted_and_covers_platforms() -> None:
categories = catalog.all_categories()
assert list(categories) == sorted(categories)
for p in catalog.PLATFORMS:
assert set(p["categories"]) <= set(categories)
def test_ai_discovery_category_present_for_geo_optimized_directories() -> None:
ai_discovery = catalog.platforms_for_category("ai_discovery")
assert ai_discovery
assert all(p["id"] == "peerpush" or "ai_discovery" in p["categories"] for p in ai_discovery)
def test_v2_directories_have_verified_at() -> None:
v2_ids = {"peerpush", "turbo0", "smol_launch", "startupbase", "microlaunch", "findly_tools"}
for platform_id in v2_ids:
assert catalog.PLATFORM_BY_ID[platform_id].get("verified_at")
def test_launching_next_url_is_the_live_www_and_trailing_slash_form() -> None:
# Regression test: the bare `https://launchingnext.com/submit` (no `www.`, no trailing
# slash) 404s in production -- found live via `directories --check-links` on 2026-10-22.
# Only `https://www.launchingnext.com/submit/` resolves; don't regress to the stale form.
platform = catalog.PLATFORM_BY_ID["launching_next"]
assert platform["url"] == "https://www.launchingnext.com/submit/"
assert platform["account_free"] is True
assert platform.get("verified_at")
def test_platforms_account_free_filters() -> None:
account_free = catalog.platforms_account_free(catalog.PLATFORMS)
assert account_free
assert all(p["account_free"] for p in account_free)
assert len(account_free) < len(catalog.PLATFORMS)
def test_platforms_account_free_excludes_known_signup_required_entries() -> None:
account_free_ids = {p["id"] for p in catalog.platforms_account_free(catalog.PLATFORMS)}
for platform_id in ("devhunt", "uneed", "turbo0", "g2", "capterra", "alternativeto"):
assert platform_id not in account_free_ids
def test_platforms_account_free_is_composable_with_category_filter() -> None:
ai_platforms = catalog.platforms_for_category("ai")
account_free_ai = catalog.platforms_account_free(ai_platforms)
assert account_free_ai
assert all(p["account_free"] and "ai" in p["categories"] for p in account_free_ai)
assert len(account_free_ai) < len(ai_platforms)