Files
5xyourteam/qa/weekend.test.cjs
martbost f56fc551fe Network Weekend (Marty 2026-11-17): 8 instant picks per position Fri 11-27 00:00 CT to Tue 12-01 00:00 CT, ribbon, chatbot facts
weekend.js: date gate by the purchase's chain time (WEEKEND_PICKS=0 switches it off, WEEKEND_NOW test clock); /api/config, quote,
order and the attach hook use it. Tank check 11-17: draft pool 1,339, 2 positions sold. netdeals.js + /assets/netweekend.js ribbon
(/api/network-deals from the hub), loaded by common.js (not draftday/admin), common.js?v=4. chatbot FACTS weekend line and a
chatcore finish hook so stored instant answers say 8 while live. qa/weekend.test.cjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 07:22:44 -06:00

27 lines
1.8 KiB
JavaScript

// Network Weekend gate (weekend.js + chatbot wording): 8 picks Fri 11-27 00:00 CT to Tue 12-01 00:00 CT, by the purchase's time.
// Tested with the WEEKEND_NOW test clock and explicit times; never the server clock.
const assert = require('assert');
const w = require('../weekend');
const C = { position: { picksOnBuy: 5 } };
const T = s => Date.parse(s);
delete process.env.WEEKEND_PICKS;
assert.strictEqual(w.picks(C, T('2026-11-27T05:59:59Z')), 5, 'Thu 23:59:59 CT: normal');
assert.strictEqual(w.picks(C, T('2026-11-27T06:00:00Z')), 8, 'Fri 00:00 CT: weekend');
assert.strictEqual(w.picks(C, T('2026-11-30T23:00:00Z')), 8, 'Cyber Monday');
assert.strictEqual(w.picks(C, T('2026-12-01T05:59:59Z')), 8, 'Mon 23:59:59 CT');
assert.strictEqual(w.picks(C, T('2026-12-01T06:00:00Z')), 5, 'Tue 00:00 CT: normal again');
process.env.WEEKEND_PICKS = '0';
assert.strictEqual(w.picks(C, T('2026-11-28T12:00:00Z')), 5, 'WEEKEND_PICKS=0 switches it off');
process.env.WEEKEND_PICKS = '12'; assert.strictEqual(w.picks(C, T('2026-11-28T12:00:00Z')), 12);
delete process.env.WEEKEND_PICKS;
process.env.WEEKEND_NOW = '2026-11-29T18:00:00Z'; assert.strictEqual(w.picks(C), 8, 'test clock'); assert.strictEqual(w.live(), true);
const bot = require('../chatbot');
assert.match(bot.SITE.finish('A $10 position gives you 5 picks right away.'), /gives you 8 picks right away \(Network Weekend/);
assert.ok(/NETWORK WEEKEND/.test(bot.SITE.facts()) && !/\u2014/.test(bot.SITE.facts()));
process.env.WEEKEND_NOW = '2026-12-01T06:00:00Z';
assert.strictEqual(bot.SITE.finish('gives you 5 picks right away'), 'gives you 5 picks right away');
assert.ok(!/NETWORK WEEKEND/.test(bot.SITE.facts()));
process.env.WEEKEND_NOW = '2026-11-20T12:00:00Z'; assert.ok(!/NETWORK WEEKEND/.test(bot.SITE.facts()), 'nothing before the window');
delete process.env.WEEKEND_NOW;
console.log('weekend gate: all pass');