// The relevance gate — the heart of the tribute site. // A story only prints if it names Sen. BAM Aquino (query jobs) or carries an // Aquino surname in a senate context (native fallback wires). import { bamRelevance } from "../lib/crawl.js"; let fails = 0; const check = (name, cond, detail = "") => { console.log(` ${cond ? "ok " : "FAIL"} ${name}${detail ? " — " + detail : ""}`); if (!cond) fails++; }; const g = (t, d = "") => bamRelevance(t, d); console.log("named BAM (admitted):"); check("full name", g("Sen. Bam Aquino backs power inquiry").named); check("Bam Aquino", g("Bam Aquino opens gaming center in Pampanga").named); check("Bam Aquino (A.)", g("Bam A. Aquino speaks in senate").named); check("Senator Bam", g("Senator Bam pushes scholarship bill").named); check("description names him", g("Senate votes on terms", "Senator Bam Aquino voted in favor of the measure.").named); check("proximity Bam...Aquino", g("Aquino clan senator", "Bam joined the floor as the Aquino senator rose to speak").named); console.log("context only (query jobs must REJECT):"); const ctx = g("Senate OKs 5-year barangay, SK terms", "Lawmakers voted 17-1 on the measure."); check("generic senate bill rejected from queries", !ctx.ok); const ctx2 = g("Hunting in the zoo", "A BusinessMirror opinion on the week's senate docket."); check("op-ed noise rejected", !ctx2.ok); console.log("context (native fallback may ADMIT):"); check("Aquino + senate admitted in fallback", bamRelevance("Aquino echoes call to probe power outages", "", { requireNamed: false }).ok); check("bare 'senate bill' rejected even in fallback", !bamRelevance("Senate OKs 5-year barangay, SK terms", "", { requireNamed: false }).ok); console.log("non-Bam Aquinos:"); const mark = g("Mark Aquino to run for mayor", "The former congressman filed his certificate of candidacy."); check("Mark Aquino not named-BAM", !mark.named); check("Mark Aquino context-admitted in fallback (he IS an Aquino in context)", bamRelevance("Mark Aquino to run for mayor", "The senator's cousin filed his papers.", { requireNamed: false }).ok); console.log("empty:"); check("empty rejected", !g("", "").ok); console.log(fails ? `\n${fails} FAILED` : "\nall passed"); process.exit(fails ? 1 : 0);