diff --git a/lib/outreach/runner.ts b/lib/outreach/runner.ts index a6773ed4..d2fc6c7a 100644 --- a/lib/outreach/runner.ts +++ b/lib/outreach/runner.ts @@ -256,6 +256,11 @@ export async function runEmailCampaignTick(campaign: CampaignRow): Promise { + const source = readFileSync(RUNNER, "utf8"); + + // Every researchProspect({...}) call in the runner. + const calls = [...source.matchAll(/researchProspect\(\{([\s\S]*?)\}\)/g)].map((m) => m[1]); + + it("researches prospects in more than one place", () => { + // If this drops to one, the test below stops proving anything. + expect(calls.length).toBeGreaterThanOrEqual(2); + }); + + it("passes skipScan at every research call site", () => { + const missing = calls.filter((body) => !body.includes("skipScan")); + expect( + missing, + `researchProspect call(s) without skipScan — a campaign with scanning off would still scan:\n${missing.join("\n---\n")}`, + ).toHaveLength(0); + }); + + it("derives skipScan from the campaign setting rather than hardcoding it", () => { + for (const body of calls) { + expect(body).toMatch(/skipScan:\s*!campaign\.scan_prospects/); + } + }); +});