One-off test-* and ad-hoc diagnostic scripts under scripts/. These are not part of bun test and do not run in CI — they exist for manual probing of individual integrations during development. Per CLAUDE.md, fresh debug scripts should go in the project root (debug-*.ts, test-*.ts); the ones below were added in scripts/ before that convention solidified.

Run them all with bun run scripts/<file>.ts.

API and structure probes

ScriptPurpose
test-api-structure.tsImports the API handler modules and asserts the exported shape. No DB or HTTP.
verify-api.tsSame idea but validates the validation/zod schemas in src/api/validation.ts.
check-api-key.tsPings the Serper API to confirm SERPER_API_KEY is valid and returns quota.
check-export.tsDiagnostic for the CSV export endpoint — runs the SQL the API would run and prints sample rows.
inspect-wins.tsQuick read-only DB report: total companies, count enriched, top 5 by confidence score. Output in Swedish.

Enrichment probes

ScriptPurpose
test-enrichment-v7.tsFull v7 pipeline runner. Multi-company suite with verbose output. Largest file in the bunch (~430 lines).
test-firecrawl-direct.tsCalls enrichV7 against org_nr=5565672655 with Firecrawl forced — bypasses Crawlee.
test-fixed-scraper.tsSmoke test for src/websiteScraper.ts against a known site. Useful after scraper-rule changes.
test-platform-scraper.tsProbes the platform-specific extractors (extractWordPressContacts, etc.) for a given URL. Pass URL as argv.
test-prat-pr-scraper-fixed.tsRegression probe for the WordPress contact extractor on pratpr.se — fixed in History Crawlee Era.
test-google-maps-enhanced.tsCalls scrapeGoogleMaps() and extractBestContactInfo(), prints all fields it can extract.
test-hunter-eniro.tsHunter.io domain search + Eniro phone lookup smoke test. Requires HUNTER_API_KEY.
test-contact-mapping.tsExercises contactPositionMapper.ts — maps free-text roles to canonical positions.
test-scb-connection.tsSCB PxWebApi v2 connectivity test. Lists tables and fetches metadata for the configured table.
benchmark-domain-discovery.tsTimes findCompanyDomain() and getDomainFromRegistry() for three hard-coded test companies.

Cache scrubbers

ScriptPurpose
clear-cache.tsGeneric cache purge. Clear by org or all caches, hits both enrichment cache and Redis. Uses tsx shebang.
clear-v7-cache.tsTargeted: deletes Redis key enrichment:<org_nr> (default 5562745926).
clear-website-cache.tsClears the website-scraper cache for a single domain. Reads REDIS_HOST / REDIS_PORT.

Warning

clear-cache.ts has a “clear ALL caches” branch — once invoked, every cached enrichment is gone and the next request re-pays the upstream API cost. Confirm your intent before running without an --org filter.

One-shot data fixes (do not re-run blindly)

ScriptPurpose
fix-vendfox-domain.tsHard-coded patch: sets Vendfox’s domain in DB and clears its Redis cache.
update-vendfox-domain.tsEven thinner version — single UPDATE companies SET domain='vendfox.se' WHERE "orgNr"='5593921082'.
enrich-company.tsManual single-company enrichment via the four-layer validation engine. Uses raw pg.Pool. Pass org_nr as argv.
enrich-lead.tsManual single-lead enrichment via the Serper-comprehensive strategy.
run-enrich.tsTwelve-line probe: runs enrichV7 on Vendfox with bypass_cache: true, prints contacts.

Warning

The two vendfox-* scripts and run-enrich.ts are tied to a specific org-nr (5593921082) baked into the source. They were diagnostic scratch from the History Crawlee Era and have no general purpose.

Archived (under scripts/archives/)

Older variants kept for reference, not for invocation:

  • enrich-and-save.ts, enrich-company-fixed.ts — earlier enrich-and-persist runners that target the v7 engine via the legacy enrichmentEngine.v7.js import path. Use scripts/enrich-company.ts instead.
  • enrich-detail.ts — debug runner for enrichmentEngine.v5.js (now superseded).
  • quality-check.ts — CLI for the quality-checker subsystem (src/quality/). Modes: per-company, batch, flagged list, stats.

See also

Test Strategy, Crawlee Scraper, Google Places, Domain Discovery.