/** * Coaster name matching tests. * * Each entry is a real case found between Queue-Times and RCDB names. * Add new cases here when fixing a mismatch or false positive. * * Run with: npm test */ import { test } from "node:test"; import assert from "node:assert/strict"; import { isCoasterMatch, normalizeForMatch } from "../lib/coaster-match"; function set(...rcdbNames: string[]): Set { return new Set(rcdbNames.map(normalizeForMatch)); } // ── Should match ───────────────────────────────────────────────────────────── const SHOULD_MATCH: [qtName: string, rcdbName: string, park: string][] = [ ["BATMAN™ The Ride", "Batman The Ride", "Over Georgia / Magic Mountain"], ["THE RIDDLER Mindbender", "Riddler Mindbender", "Over Georgia"], ["THE RIDDLER™'s Revenge", "Riddler's Revenge", "Magic Mountain"], ["CATWOMAN™ Whip", "Catwoman's Whip", "New England"], ["SUPERMAN™: Ultimate Flight", "Superman - Ultimate Flight", "Over Georgia"], ["THE JOKER™ Funhouse Coaster", "Joker Funhouse Coaster", "Over Georgia"], ["The Great American Scream Machine", "Great American Scream Machine", "Over Georgia"], ["Apocalypse", "Apocalypse the Ride", "Magic Mountain"], ["The New Revolution - Classic", "New Revolution", "Magic Mountain"], ["SCREAM", "Scream!", "Magic Mountain"], ["BAT GIRL™: Coaster Chase", "Batgirl Coaster Chase", "Fiesta Texas"], ["THE JOKER™ 4D Free Fly Coaster", "Joker", "New England"], ]; for (const [qt, rcdb, park] of SHOULD_MATCH) { test(`match: "${qt}" = "${rcdb}" (${park})`, () => { assert.ok(isCoasterMatch(qt, set(rcdb)), `Expected match`); }); } // ── Should NOT match (false positives) ─────────────────────────────────────── const SHOULD_NOT_MATCH: [qtName: string, rcdbName: string, park: string][] = [ ["Joker y Harley Quinn", "Joker", "Six Flags Mexico"], ]; for (const [qt, rcdb, park] of SHOULD_NOT_MATCH) { test(`no match: "${qt}" ≠ "${rcdb}" (${park})`, () => { assert.ok(!isCoasterMatch(qt, set(rcdb)), `Expected no match`); }); }