test: add coaster name matching test suite

Extract matching logic into lib/coaster-match.ts (isCoasterMatch + normalizeForMatch)
so it can be imported by both the scraper and tests without duplication.

Add tests/coaster-matching.test.ts covering all known match/false-positive cases:
- Trademark symbols, leading THE, possessives, punctuation
- Subtitle variants in both directions (Apocalypse, New Revolution - Classic)
- Space-split brand words (BAT GIRL vs Batgirl)
- 4D subtitle extension (THE JOKER™ 4D Free Fly Coaster vs Joker)
- False positives: Joker y Harley Quinn, conjunction connectors

Run with: npm test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-04 15:43:20 -04:00
parent dc4fbeb7ec
commit 9cac86d241
5 changed files with 161 additions and 51 deletions

View File

@@ -10,7 +10,8 @@
"scrape": "tsx scripts/scrape.ts",
"scrape:force": "tsx scripts/scrape.ts --rescrape",
"discover": "tsx scripts/discover.ts",
"debug": "tsx scripts/debug.ts"
"debug": "tsx scripts/debug.ts",
"test": "tsx --test tests/*.test.ts"
},
"dependencies": {
"better-sqlite3": "^12.8.0",