More real cables: North Sea, Baltic, Tampnet, Indian Ocean and Asia-Pacific
North Sea and Baltic: Kristiansand, Esbjerg and Riga as new landings. Havfrue's Danish and Norwegian landings, HAVSIL, Skagenfiber, Norfest and NorSea Com (Tampnet, past the Draupner and Ekofisk platforms to Lowestoft), CeltixConnect-2 and North Sea Connect, C-Lion1's real Rostock landing, GlobalConnect's Digital E4, Eastern Light, the Elisa cables, Latvia-Sweden and BCS. Baltic cables carry an anchor flag that makes them cut more often (it used to be a list of two ids). Indian Ocean and Asia-Pacific: Muscat, Malé and Fukuoka as new landings. SJC2, ADC, ASE, APCN-2, EAC-C2C, FLAG and its North Asia loop, SEA-ME-WE 5, Unity, TGN-IA, TPE, Hong Kong-Guam, MIST, IAX, TIC, TW1, MCT and KJCN as puns; the missing real landings on SEA-ME-WE 4 and 6, AAE-1, PEACE, APG, SJC, PLCN, NCP, FASTER, JUPITER, Indigo, Bifrost, 2Africa Pearls and the Oman Australia cable. Existing pairs are untouched so saved links keep their cable. Routes come from the game's own sea router. Tests that relied on Colombo having one cable and Oslo having none now use St Helena and Zurich.
This commit is contained in:
parent
5538e5109b
commit
9df1835f70
16 changed files with 317 additions and 43 deletions
|
|
@ -815,16 +815,16 @@ test('cancelling from the Connections list confirms once, without forging the pa
|
|||
test('diversity offers respect buildable cable routes, not current infrastructure', () => {
|
||||
const { ev, dom, errors } = load();
|
||||
base(ev);
|
||||
assert.equal(ev("diversityPossible('cbo','den')"), false, 'both Colombo exits share SEE-ME-WAVE 4');
|
||||
assert.equal(ev("diversityPossible('den','cbo')"), false, 'same in reverse');
|
||||
assert.equal(ev("diversityPossible('jam','den')"), false, 'both St Helena exits share Equi-yes');
|
||||
assert.equal(ev("diversityPossible('den','jam')"), false, 'same in reverse');
|
||||
assert.equal(ev("diversityPossible('fra','den')"), true, 'expansion is allowed before links are built');
|
||||
ev("S.ev.landban={city:'cbo',until:S.day+100}");
|
||||
ev("S.ev.landban={city:'jam',until:S.day+100}");
|
||||
ev('S.won=true');
|
||||
assert.equal(ev("diversityPossible('cbo','den')"), true, 'Tier 1 can build an independent subsea cable');
|
||||
ev("S.scn={rules:{banCities:['cbo']}}");
|
||||
assert.equal(ev("diversityPossible('cbo','den')"), false, 'scenario city bans are respected');
|
||||
assert.equal(ev("diversityPossible('jam','den')"), true, 'Tier 1 can build an independent subsea cable');
|
||||
ev("S.scn={rules:{banCities:['jam']}}");
|
||||
assert.equal(ev("diversityPossible('jam','den')"), false, 'scenario city bans are respected');
|
||||
ev('S.scn=null;S.won=false');
|
||||
assert.equal(ev("diversityPossible('cbo','den')"), false, 'cache follows the cable unlock');
|
||||
assert.equal(ev("diversityPossible('jam','den')"), false, 'cache follows the cable unlock');
|
||||
assert.deepEqual(errors, []);
|
||||
dom.window.close();
|
||||
});
|
||||
|
|
@ -850,7 +850,7 @@ test('save migration checks diversity using the imported cable unlock', () => {
|
|||
const { ev, dom, errors } = load();
|
||||
base(ev);
|
||||
ev(`window.__save=JSON.parse(JSON.stringify(S));__save.offers=[
|
||||
{id:'bad',type:'hyper',city:'cbo',city2:'den',name:'x',bw:1600,rate:1,reqs:['diverse','netchill'],exp:40},
|
||||
{id:'bad',type:'hyper',city:'jam',city2:'den',name:'x',bw:1600,rate:1,reqs:['diverse','netchill'],exp:40},
|
||||
{id:'good',type:'hyper',city:'fra',city2:'den',name:'y',bw:1600,rate:1,reqs:['diverse'],exp:40}
|
||||
];__save.biz=[{...__save.offers[0],id:'existing',mood:100,since:0}];S.won=true;__save.won=false`);
|
||||
assert.deepEqual(JSON.parse(ev('JSON.stringify(migrate(JSON.parse(JSON.stringify(__save))).offers.map(o=>o.reqs))')), [['netchill'], ['diverse']]);
|
||||
|
|
@ -1083,9 +1083,9 @@ test('#88 no subsea cable longer than any optic can light, and a refund for call
|
|||
|
||||
test('#50 a city without a cable landing points to the nearest one', () => {
|
||||
const { ev, errors } = load();
|
||||
ev("ACT.start({});S.cash=1e9;S.lvl=4;for(const g of GOALS)S.done[g.id]=0;ACT.buildPop({city:'osl'});UI.pending=null;openLinkModal('osl','nyc')");
|
||||
ev("ACT.start({});S.cash=1e9;S.lvl=4;for(const g of GOALS)S.done[g.id]=0;ACT.buildPop({city:'zrh'});UI.pending=null;openLinkModal('zrh','nyc')");
|
||||
const t = ev("$('modalCard').textContent");
|
||||
assert.match(t, /No subsea cable lands in Oslo\. The nearest landing station is Stavanger/);
|
||||
assert.match(t, /No subsea cable lands in Zurich\. The nearest landing station is Milan/);
|
||||
assert.doesNotMatch(t, /nowhere/);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
49
tests/more-cables.test.js
Normal file
49
tests/more-cables.test.js
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
// More real cables: the North Sea and the Baltic, the Indian Ocean and Asia-Pacific.
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert');
|
||||
const { load } = require('./harness');
|
||||
|
||||
function start(ev) { ev("ACT.start({});S.cash=1e9;S.lvl=6;for(const g of GOALS)S.done[g.id]=0"); }
|
||||
const lands = (ev, cid, a, b) => ev(`CABLE_PAIRS.some(p=>p.cid==='${cid}'&&[p.a,p.b].sort().join()==='${[a, b].sort().join()}')`);
|
||||
|
||||
test('the North Sea and the Baltic: new landings, real cables, and anchors on the Baltic ones', () => {
|
||||
const { ev, errors } = load();
|
||||
start(ev);
|
||||
for (const c of ['krs', 'ebj', 'rix']) {
|
||||
assert.ok(ev(`CABLE_PAIRS.some(p=>p.a==='${c}'||p.b==='${c}')`), `${c} has a cable`);
|
||||
assert.ok(ev(`NETS.some(n=>n.price&&n.pops.includes('${c}'))`), `${c} has a transit seller`);
|
||||
}
|
||||
assert.ok(ev("CITY.rix.ix.length>0&&ixMembers('rix').includes('tet')"), 'Riga has its exchange');
|
||||
assert.ok(lands(ev, 'havf', 'ebj', 'krs') && lands(ev, 'havf', 'nyc', 'ebj') && lands(ev, 'havsil', 'krs', 'ebj') && lands(ev, 'norfest', 'svg', 'krs'));
|
||||
assert.ok(lands(ev, 'havh', 'dub', 'man') && lands(ev, 'clion', 'hel', 'ham') && lands(ev, 'e4', 'ber', 'cph') && lands(ev, 'lvse', 'rix', 'sto'));
|
||||
// Tampnet: NorSea Com from Kårstø past the Draupner and Ekofisk platforms to Lowestoft, and Norfest down the coast
|
||||
assert.ok(lands(ev, 'tampn', 'svg', 'lon') && lands(ev, 'norfest', 'krs', 'osl'));
|
||||
// the Baltic cables are the ones the anchors find
|
||||
for (const c of ['clion', 'balt', 'e4', 'elight', 'elisa', 'lvse', 'bcs']) assert.equal(ev(`CAB.${c}.anchor`), true, c);
|
||||
assert.equal(ev('CAB.marea.anchor'), undefined);
|
||||
// old pairs stay where they were, so saved links keep their cable
|
||||
assert.equal(ev("CAB.havf.pairs.slice(0,2).map(p=>p.slice(0,2).join()).join(' ')"), 'nyc,cph dub,cph');
|
||||
assert.equal(ev("CAB.clion.pairs[0].slice(0,2).join()"), 'hel,fra');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('the Indian Ocean and Asia-Pacific: the big real cables, Muscat, the Maldives and Fukuoka', () => {
|
||||
const { ev, errors } = load();
|
||||
start(ev);
|
||||
for (const c of ['mct', 'mle', 'fuk']) {
|
||||
assert.ok(ev(`CABLE_PAIRS.some(p=>p.a==='${c}'||p.b==='${c}')`), `${c} has a cable`);
|
||||
assert.ok(ev(`NETS.some(n=>n.price&&n.pops.includes('${c}'))`), `${c} has a transit seller`);
|
||||
}
|
||||
assert.ok(ev("isSub('mle','cbo')&&!isSub('mct','dxb')&&!isSub('fuk','tok')"), 'the Maldives are islands, Muscat and Fukuoka are not');
|
||||
for (const [cid, a, b] of [['sjc2', 'tpe', 'osa'], ['adc', 'sin', 'bkk'], ['apcn2', 'tpe', 'sha'], ['flag', 'bde', 'pmo'], ['smw5', 'khi', 'cbo'], ['unity', 'tok', 'lax'],
|
||||
['tpe2', 'sea', 'sha'], ['mist', 'maa', 'kul'], ['iax', 'bom', 'mle'], ['kjcn', 'icn', 'fuk'], ['smw6', 'bom', 'mle'], ['twoaf', 'mct', 'khi'], ['ohman', 'per', 'mct'], ['bifrost', 'jkt', 'gum'], ['indigo', 'per', 'syd']]) {
|
||||
assert.ok(lands(ev, cid, a, b), `${cid} ${a}-${b}`);
|
||||
}
|
||||
// every cable pair has a drawn route and a sane length
|
||||
assert.equal(ev("CABLE_PAIRS.filter(p=>!(p.km>0&&p.km<25000)||p.pts.some(q=>!isFinite(q[0])||!isFinite(q[1]))).length"), 0);
|
||||
// a hop on one of the new cables carries traffic
|
||||
ev("for(const c of ['sin','hkg']){ACT.buildPop({city:c});S.pops[c].rgen=3;}UI.via='sjc2';UI.route='same';openLinkModal('sin','hkg');ACT.buildLink({tier:2});closeModal();compute()");
|
||||
assert.ok(ev("S.links.some(l=>l.cable==='sjc2')"), 'a wave on SJC2');
|
||||
ev('cam.z=0.5;draw(0);cam.z=4;cam.x=CITY.mle.x;cam.y=CITY.mle.y;draw(0)');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue