diff --git a/site/index.html b/site/index.html index 0d70c11..3093f36 100644 --- a/site/index.html +++ b/site/index.html @@ -1889,7 +1889,7 @@ function dayTick(){ if(R&&R.demand>0)S.stats.clean=R.served/R.demand>=0.995?(S.stats.clean||0)+1:0; if(S.ev.php===d)toast('The internet is back.
Half of it, anyway. Everything was patched in a hurry and nobody learned anything.','good'); for(const k in S.peers){const [id,c]=k.split('@'),sn=snub(id,c);if(!sn)continue;delete S.peers[k];S.stats.depeered=(S.stats.depeered||0)+1; - toast(`${esc(NET[id].name)} de-peered you in ${esc(CITY[c].name)}.
${esc(sn.why)} Traffic falls back to your next best path.`,'bad');} + toast(`${esc(NET[id].name)} de-peered you in ${esc(CITY[ixCity(c)].name)}.
${esc(sn.why)} Traffic falls back to your next best path.`,'bad');} if(S.cnLic&&S.cnLic.state==='pending'&&d>=S.cnLic.ready){S.cnLic.state='ok';toast('License granted!
Your joint venture can now build POPs in mainland China.','goal');sfx('coin');} // resolve incidents for(const i of S.inc.slice())if(i.until<=d){clearInc(i);toast(`Resolved: ${incTitle(i.type).toLowerCase()} is fixed.`,'good');} diff --git a/tests/peering.test.js b/tests/peering.test.js index b3f5d54..696907b 100644 --- a/tests/peering.test.js +++ b/tests/peering.test.js @@ -113,3 +113,14 @@ test('DE-KICKS hides prices, haggles, harmonises upwards, auto-enrolls add-ons a assert.equal(ev("ixPortMo('ams',1)"), ev("Math.round(PORT[1].ix*ixMul('ams'))"), 'other IXs keep open pricing'); assert.deepEqual(errors, []); }); + +test('a peer at a rival exchange can de-peer you without stopping the game', () => { + const { ev, errors } = load(); + ev('ACT.start({})'); + const ix = ev('Object.keys(XIXM)[0]'); + ev(`S.peers['ggl@${ix}']=true;window.snub=()=>({why:'Testing.'})`); + ev('dayTick()'); + assert.equal(ev(`'ggl@${ix}' in S.peers`), false); + assert.match(ev("document.getElementById('toasts').textContent"), new RegExp(`de-peered you in ${ev(`CITY[ixCity('${ix}')].name`)}`)); + assert.deepEqual(errors, []); +});