// Guides pages (Marty 2026-11-17): the static numbers on /guides/* must match config.js (the source the chatbot reads), // every guide is routed and in the sitemap list, and the house copy rules hold. Run: node qa/guides.test.cjs 'use strict'; const fs = require('fs'), path = require('path'), assert = require('assert'); const C = require('../config').get(); const PUB = path.join(__dirname, '..', 'public'); const FILES = ['guides.html', 'guides/how-the-draft-works.html', 'guides/is-5xyourteam-legit.html', 'guides/coaching-your-picks.html', 'guides/faq.html']; let n = 0; const ok = (c, m) => { assert.ok(c, m); n++; }; const read = f => fs.readFileSync(path.join(PUB, f), 'utf8'); const all = FILES.map(read).join('\n'); const srv = fs.readFileSync(path.join(__dirname, '..', 'server.js'), 'utf8'); for (const f of FILES) { const h = read(f), url = '/' + f.replace(/\.html$/, ''); ok(h.includes(''), f + ': canonical'); ok(//.test(h), f + ': meta description'); ok(h.includes('og:title') && h.includes('og:image'), f + ': OG tags'); ok(srv.includes("'" + url + "': '" + f + "'"), f + ': routed in server.js'); ok(srv.includes("'" + url + "'"), f + ': in the sitemap list'); ok(!/[—–]|--/.test(h.replace(//g, '')), f + ': no em/en dashes or double hyphens'); ok(!/rm circle/i.test(h), f + ': never RM Circle'); ok(h.includes('not income. Nothing is promised.'), f + ': the not-income line'); } // numbers vs config (the defaults the live app runs with) const P = C.position, S = C.split, D = C.draft, K = C.picks; ok(all.includes('$' + P.usd + ' one-time') || all.includes('$' + P.usd + ' one time'), 'price'); ok(all.includes(P.picksOnBuy + ' picks right away'), 'instant picks'); ok(D.dow === 1 && D.hour === 19 && all.includes('Monday at 7 PM Central'), 'draft day + hour'); ok(all.includes(D.rounds + ' rounds'), 'rounds'); ok(all.includes(D.pickSeconds + '-second clock'), 'pick clock'); ok(all.includes('more than ' + D.lateHours + ' hours late'), 'late skip'); ok(all.includes('after ' + K.returnDays + ' days'), 'return days'); ok(all.includes('first ' + K.holdHours + ' hours'), 'release hold'); ok(all.includes(K.maxOpen + ' open picks'), 'max open'); ok(all.includes('first ' + K.graceHours + ' hours'), 'sign-up grace'); ok(all.includes(K.maxAdoptions + ' adoptions'), 'adoption limit'); ok(all.includes('1 to ' + P.maxQty), 'max per payment'); ok(C.pot.split.join(',') === '50,30,20' && all.includes('50, 30 and 20 percent'), 'pot places'); ok(all.includes(S.sponsorPct + '% ($' + (P.usd * S.sponsorPct / 100).toFixed(2) + ')'), 'sponsor share'); ok(all.includes(S.levelPct + '% each ($' + (P.usd * S.levelPct / 100).toFixed(2) + ' each)'), 'level share'); ok(all.includes(S.potPct + '% ($' + (P.usd * S.potPct / 100).toFixed(2) + ')'), 'pot share'); ok(all.includes(S.companyPct + '% ($' + (P.usd * S.companyPct / 100).toFixed(2) + ')'), 'company share'); ok(S.sponsorPct + 4 * S.levelPct + S.potPct + S.companyPct === 100, 'split adds to 100'); ok(all.includes('up to ' + S.maxDepth + ' places'), 'pass-up depth'); console.log('guides: ' + n + ' checks passed');