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
| Script | Purpose |
|---|---|
test-api-structure.ts | Imports the API handler modules and asserts the exported shape. No DB or HTTP. |
verify-api.ts | Same idea but validates the validation/zod schemas in src/api/validation.ts. |
check-api-key.ts | Pings the Serper API to confirm SERPER_API_KEY is valid and returns quota. |
check-export.ts | Diagnostic for the CSV export endpoint — runs the SQL the API would run and prints sample rows. |
inspect-wins.ts | Quick read-only DB report: total companies, count enriched, top 5 by confidence score. Output in Swedish. |
Enrichment probes
| Script | Purpose |
|---|---|
test-enrichment-v7.ts | Full v7 pipeline runner. Multi-company suite with verbose output. Largest file in the bunch (~430 lines). |
test-firecrawl-direct.ts | Calls enrichV7 against org_nr=5565672655 with Firecrawl forced — bypasses Crawlee. |
test-fixed-scraper.ts | Smoke test for src/websiteScraper.ts against a known site. Useful after scraper-rule changes. |
test-platform-scraper.ts | Probes the platform-specific extractors (extractWordPressContacts, etc.) for a given URL. Pass URL as argv. |
test-prat-pr-scraper-fixed.ts | Regression probe for the WordPress contact extractor on pratpr.se — fixed in History Crawlee Era. |
test-google-maps-enhanced.ts | Calls scrapeGoogleMaps() and extractBestContactInfo(), prints all fields it can extract. |
test-hunter-eniro.ts | Hunter.io domain search + Eniro phone lookup smoke test. Requires HUNTER_API_KEY. |
test-contact-mapping.ts | Exercises contactPositionMapper.ts — maps free-text roles to canonical positions. |
test-scb-connection.ts | SCB PxWebApi v2 connectivity test. Lists tables and fetches metadata for the configured table. |
benchmark-domain-discovery.ts | Times findCompanyDomain() and getDomainFromRegistry() for three hard-coded test companies. |
Cache scrubbers
| Script | Purpose |
|---|---|
clear-cache.ts | Generic cache purge. Clear by org or all caches, hits both enrichment cache and Redis. Uses tsx shebang. |
clear-v7-cache.ts | Targeted: deletes Redis key enrichment:<org_nr> (default 5562745926). |
clear-website-cache.ts | Clears the website-scraper cache for a single domain. Reads REDIS_HOST / REDIS_PORT. |
Warning
clear-cache.tshas 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--orgfilter.
One-shot data fixes (do not re-run blindly)
| Script | Purpose |
|---|---|
fix-vendfox-domain.ts | Hard-coded patch: sets Vendfox’s domain in DB and clears its Redis cache. |
update-vendfox-domain.ts | Even thinner version — single UPDATE companies SET domain='vendfox.se' WHERE "orgNr"='5593921082'. |
enrich-company.ts | Manual single-company enrichment via the four-layer validation engine. Uses raw pg.Pool. Pass org_nr as argv. |
enrich-lead.ts | Manual single-lead enrichment via the Serper-comprehensive strategy. |
run-enrich.ts | Twelve-line probe: runs enrichV7 on Vendfox with bypass_cache: true, prints contacts. |
Warning
The two
vendfox-*scripts andrun-enrich.tsare 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 legacyenrichmentEngine.v7.jsimport path. Usescripts/enrich-company.tsinstead.enrich-detail.ts— debug runner forenrichmentEngine.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.