Files
SixFlagsSuperCalendar/tests/coaster-matching.test.ts
josh 766fc296a1
All checks were successful
Build and Deploy / Build & Push (push) Successful in 3m0s
fix: isCoaster typo in top-level rides loop; simplify test structure
- isCoaster → isCoasterMatch on line 109 (missed rename causing runtime crash
  which returned null from fetchLiveRides, breaking the entire ride panel)
- Rewrite test as two flat arrays: SHOULD_MATCH and SHOULD_NOT_MATCH pairs,
  each with the QT name, RCDB name, and park for context

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 15:49:47 -04:00

52 lines
2.5 KiB
TypeScript

/**
* 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<string> {
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`);
});
}