Tests: route fuzz compares the customer catalog, day steps waits longer for its trial

A new customer type changes which offers a seeded late-game draws, so the
fuzz games cannot play move for move like main (as with a world change), and
the sales-trial race in day-steps comes on day 46 instead of before day 20.
This commit is contained in:
Frederic Jung 2026-11-10 07:14:36 +00:00
parent e51510a115
commit d8223bad04
No known key found for this signature in database
2 changed files with 6 additions and 5 deletions

View file

@ -189,7 +189,8 @@ test('a customer dropped while a sales trial routes: the trial runs again on the
p.ev(TICK_ERR); p.ev(TICK_ERR);
p.ev("window.__ot=0;const ot=offerTrial;offerTrial=(...a)=>{__ot++;return ot(...a);};"); p.ev("window.__ot=0;const ot=offerTrial;offerTrial=(...a)=>{__ot++;return ot(...a);};");
let found = false; let found = false;
for (let d = 0; d < 20 && !found; d++) { // Which day such a trial comes depends on the offers the seeded game draws (day 46 since latency contracts joined them).
for (let d = 0; d < 60 && !found; d++) {
p.ev('rwDay()'); p.ev('rwDay()');
for (let k = 0; k < 400 && p.ev('!!RW.job'); k++) { for (let k = 0; k < 400 && p.ev('!!RW.job'); k++) {
if (p.ev('__later.length')) { p.ev('__later.shift()()'); continue; } if (p.ev('__later.length')) { p.ev('__later.shift()()'); continue; }

View file

@ -17,10 +17,10 @@ function pages() {
let base = head; let base = head;
try { const b = path.join(os.tmpdir(), `tubes-fuzz-test-${process.pid}-base.html`); fs.writeFileSync(b, page.assembleRef('origin/main')); base = b; } catch (e) {} try { const b = path.join(os.tmpdir(), `tubes-fuzz-test-${process.pid}-base.html`); fs.writeFileSync(b, page.assembleRef('origin/main')); base = b; } catch (e) {}
let P = { base: openPage(base, 'base'), head: openPage(head, 'head') }; let P = { base: openPage(base, 'base'), head: openPage(head, 'head') };
// A change to the world itself (cities, networks, cables) or to what links cost cannot route like main: there is no // A change to the world itself (cities, networks, cables, the kinds of customers that call) or to what links cost
// same game to compare. Then the base is this checkout too, and the cache on/off check still runs; equivalence with // cannot route like main: there is no same game to compare. Then the base is this checkout too, and the cache on/off
// main resumes once it lands. // check still runs; equivalence with main resumes once it lands.
const world = (p) => p.ev("JSON.stringify([CITIES.map(c=>[c.id,c.land,c.P]),NETS.map(n=>[n.id,n.pops,n.ix,n.share,n.price,n.up]),CABLES.map(c=>[c.id,c.pairs.map(q=>[q[0],q[1]])]),[1,300,3000].map(k=>[dfLeaseMo(k),waveMo(k,false,2),dfBuildCost(k)])])"); const world = (p) => p.ev("JSON.stringify([CITIES.map(c=>[c.id,c.land,c.P]),NETS.map(n=>[n.id,n.pops,n.ix,n.share,n.price,n.up]),CABLES.map(c=>[c.id,c.pairs.map(q=>[q[0],q[1]])]),[1,300,3000].map(k=>[dfLeaseMo(k),waveMo(k,false,2),dfBuildCost(k)]),Object.keys(BIZ_T).map(t=>[t,BIZ_T[t].lv||1,BIZ_T[t].opts])])");
if (base !== head && world(P.base) !== world(P.head)) { console.log('# route fuzz: the world or its prices differ from main, so both pages are this checkout'); P = { base: openPage(head, 'base'), head: P.head }; } if (base !== head && world(P.base) !== world(P.head)) { console.log('# route fuzz: the world or its prices differ from main, so both pages are this checkout'); P = { base: openPage(head, 'base'), head: P.head }; }
return P; return P;
} }