Merge remote-tracking branch 'origin/main' into HEAD

# Conflicts:
#	CHANGELOG.md
This commit is contained in:
Frederic Jung 2026-10-31 15:00:36 +01:00
commit 20c70f16e6
No known key found for this signature in database
17 changed files with 260 additions and 26 deletions

75
tests/durations.json Normal file
View file

@ -0,0 +1,75 @@
{
"tests/any-home-city.test.js": 12.0,
"tests/architect.test.js": 20.1,
"tests/automation.test.js": 13.8,
"tests/backbone-core.test.js": 27.5,
"tests/badges-variants.test.js": 20.2,
"tests/build.test.js": 1.3,
"tests/capacity-deals.test.js": 12.6,
"tests/chaos-monkey.test.js": 30.3,
"tests/city-size.test.js": 8.5,
"tests/compute-idempotent.test.js": 10.4,
"tests/ddos-floods.test.js": 22.8,
"tests/ddos-model.test.js": 31.7,
"tests/eyeballs.test.js": 13.0,
"tests/fiber-broker.test.js": 9.7,
"tests/find-city.test.js": 9.6,
"tests/game.test.js": 42.8,
"tests/gameplay-rules.test.js": 42.9,
"tests/gangnam.test.js": 12.3,
"tests/glowball-sakura-lager.test.js": 15.8,
"tests/i18n.test.js": 59.9,
"tests/islands-and-arctic.test.js": 13.7,
"tests/issues.test.js": 103.0,
"tests/language-picker.test.js": 12.5,
"tests/latency.test.js": 11.1,
"tests/levels.test.js": 16.3,
"tests/link-metrics.test.js": 22.0,
"tests/link-trial.test.js": 6.4,
"tests/load-time.test.js": 102.7,
"tests/metric-panel.test.js": 8.1,
"tests/modes.test.js": 41.1,
"tests/more-cables.test.js": 14.3,
"tests/moscow-premium.test.js": 12.0,
"tests/networks-list.test.js": 6.4,
"tests/new-game-speed.test.js": 10.1,
"tests/optic-counts.test.js": 9.7,
"tests/own-asn.test.js": 7.9,
"tests/pages.test.js": 12.4,
"tests/peering-desk.test.js": 13.9,
"tests/peering.test.js": 27.6,
"tests/perf.test.js": 10.9,
"tests/persist.test.js": 16.1,
"tests/pni-all.test.js": 12.5,
"tests/pni-global.test.js": 17.9,
"tests/pni-list.test.js": 15.4,
"tests/pnis-and-sold-out.test.js": 11.6,
"tests/puzzle-monkey.test.js": 7.9,
"tests/puzzles.test.js": 73.3,
"tests/regions.test.js": 80.3,
"tests/release-story.test.js": 2.8,
"tests/report-link.test.js": 12.0,
"tests/router-art.test.js": 7.8,
"tests/routers-per-pop.test.js": 8.1,
"tests/routing-reference.test.js": 11.6,
"tests/rules-locked.test.js": 8.4,
"tests/rules.test.js": 29.4,
"tests/sales-trial.test.js": 33.3,
"tests/save-size.test.js": 16.1,
"tests/save-slots.test.js": 48.5,
"tests/scenarios-playtest.test.js": 113.2,
"tests/sea-routing.test.js": 42.6,
"tests/services.test.js": 15.7,
"tests/specialist.test.js": 14.3,
"tests/speed.test.js": 144.6,
"tests/standing-orders.test.js": 66.8,
"tests/subsea-upgrade-timing.test.js": 13.5,
"tests/supply.test.js": 11.0,
"tests/tier1-cone.test.js": 19.8,
"tests/useless-subsea-upgrades.test.js": 7.2,
"tests/utilities-caches.test.js": 9.5,
"tests/utilities.test.js": 15.6,
"tests/weekly-architect.test.js": 28.7,
"tests/weekly-puzzle.test.js": 145.0,
"tests/weekly-scenario.test.js": 54.4
}

View file

@ -596,6 +596,30 @@ test('#228 the intern names the exchanges it peered at, even one that shares its
assert.deepEqual(errors, []);
});
test('#227 transit "Already connected" grows the providers you have, the smallest first, and never signs a new one', t => {
const { ev, errors } = game(t, "ACT.buyTransit({city:'fra',net:'ntt',tier:1});compute()");
hire(ev); on(ev, 'transit', { x: 1.5, prov: 'have' });
const capOf = net => ev(`(()=>{const t=S.transit.find(x=>x.city==='fra'&&x.net==='${net}');return lagCap(PORT[t.tier].g,t.n)})()`);
const c0 = capOf('cog'), n0 = capOf('ntt');
assert.equal(c0, n0, 'two equal ports to start');
ev('for(const t of S.transit)t.hist=[100]'); shift(ev);
assert.equal(ev("JSON.stringify(S.transit.filter(t=>t.city==='fra').map(t=>t.net).sort())"), '["cog","ntt"]', 'no new provider');
assert.ok(capOf('cog') > c0 && capOf('ntt') > n0, 'both grew, not just one');
assert.equal(capOf('cog'), capOf('ntt'), 'evenly, smallest first');
// a POP whose only upstream is not the cheapest never gets the cheapest added (Cheapest would buy Cogentle there)
ev("ACT.buildPop({city:'ams'});S.pops.ams.rgen=1;ACT.launchBB({city:'ams'});ACT.buyTransit({city:'ams',net:'ntt',tier:1});compute()");
assert.equal(ev("cheapestTransit('ams').id"), 'cog');
ev("for(const t of S.transit)t.hist=[400]"); ev('S.day++'); shift(ev);
assert.equal(ev("JSON.stringify(S.transit.filter(t=>t.city==='ams').map(t=>t.net))"), '["ntt"]');
// the setting cycles through it, reads "Already connected" and survives a save
ev("S.ops.p.transit.prov='cheap';ACT.opsParam({k:'transit',p:'prov'})");
assert.equal(ev("opsP('transit','prov')"), 'have');
assert.equal(ev("opsVal('transit','prov')"), 'Already connected');
ev('S=migrate(JSON.parse(JSON.stringify(S)))');
assert.equal(ev("opsP('transit','prov')"), 'have');
assert.deepEqual(errors, []);
});
test('#244 the PNI order counts the traffic the PNI list shows at that POP, not what cache boxes there already serve', t => {
const { ev, errors } = game(t, "ACT.buildPop({city:'ham'});for(const c of ['fra','ham']){S.pops[c].rgen=mainRG(4);S.pops[c].routers=6;if(!S.pops[c].bb)ACT.launchBB({city:c});S.pops[c].bb.d=CITY[c].P*0.9;}UI.pending={a:'fra',b:'ham'};ACT.buildLink({tier:3});closeModal();ACT.buyTransit({city:'fra',net:'cog',tier:3});ACT.buyTransit({city:'ham',net:'cog',tier:3});for(let i=0;i<6;i++)S.caches.push({id:'nfx'+i,city:'ham',net:'nfx'});compute()");
// Hamburg's users want a lot from NetChill, but its cache boxes there serve most of it: little is left for a PNI