Merge remote-tracking branch 'origin/main' into claude/noc-open
# Conflicts: # CHANGELOG.md
This commit is contained in:
commit
2c60af18cc
16 changed files with 84 additions and 14 deletions
|
|
@ -163,3 +163,20 @@ test('architect runs: the map tells two tubes in one trench from two separate pa
|
|||
assert.deepEqual(JSON.parse(ev("JSON.stringify(AR_PILLS.map(p=>p[2]).sort())")), ['2× one trench', '✓ 2 paths']);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('#231 the puzzle list counts each section\'s own stars: runs above, packs next to the packs', () => {
|
||||
const { ev, errors } = load();
|
||||
// 2 stars on a pack puzzle, 2 on Euro Run, 3 on another run
|
||||
ev("localStorage.setItem(PZ_KEY,JSON.stringify({set:PZ_SET,noted:1,s:{[PZ[0].id]:{st:2}}}));localStorage.setItem(AR_KEY,JSON.stringify({runs:{[AR_RUNS[0].id]:{st:2},[AR_RUNS[1].id]:{st:3}}}))");
|
||||
ev('ACT.puzzleMenu()');
|
||||
const heads = JSON.parse(ev("JSON.stringify([...document.querySelectorAll('#modal h3.pzpack')].map(h=>h.textContent))"));
|
||||
assert.match(heads[0], new RegExp(`Architect runs ⭐ 5/${3 * ev('AR_RUNS.length')}`), heads[0]);
|
||||
// the packs' total sits right above the first pack, after the runs and the weekly puzzle, and says what it counts
|
||||
const order = ev(`(()=>{const m=document.querySelector('#modal'),box=m.querySelector('.pzprog'),run=m.querySelector('[data-act=pzArStart]'),pack=[...m.querySelectorAll('h3.pzpack')].find(h=>!h.textContent.includes('🏗️'));
|
||||
return [!!(run.compareDocumentPosition(box)&Node.DOCUMENT_POSITION_FOLLOWING),!!(box.compareDocumentPosition(pack)&Node.DOCUMENT_POSITION_FOLLOWING),box.textContent].join('|')})()`);
|
||||
const [afterRuns, beforePacks, box] = order.split('|');
|
||||
assert.equal(afterRuns, 'true', 'below the architect runs');
|
||||
assert.equal(beforePacks, 'true', 'above the first pack');
|
||||
assert.match(box, new RegExp(`Stars from the packs⭐ 2 / ${3 * ev('PZ.length')}`), box);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -79,3 +79,25 @@ test('draft counts and quotes stay together when reopening a panel or using shor
|
|||
assert.equal(field().value,'','empty in-progress entry survives a tick');
|
||||
}finally{dom.window.close();}
|
||||
});
|
||||
test('#229 giving up a fiber puts its optics on the spares shelf, and so does decommissioning its POP',()=>{
|
||||
const {ev,dom,errors}=load();try{
|
||||
setup(ev);
|
||||
// a leased IRU (not your own build) with mixed optics
|
||||
ev("Object.assign(S.links[0],{own:false,ch:['zr4','zr4','tp16']});S.spares={zr4:1};compute()");
|
||||
ev("ACT.rmLink({id:'fiber'})");assert.equal(ev('S.links.length'),1,'the first click only asks');
|
||||
ev("ACT.rmLink({id:'fiber'})");assert.equal(ev('S.links.length'),0,'cancelled');
|
||||
assert.equal(ev('S.spares.zr4'),3);assert.equal(ev('S.spares.tp16'),1);
|
||||
assert.match(ev("S.log.map(e=>e.t).join(' | ')"),/3 optics went back on the spares shelf/);
|
||||
// the next channel of that type uses a spare for free
|
||||
ev("S.links.push({id:'f2',a:'fra',b:'ams',kind:'df',own:true,sys:'roadm',km:400,ch:[],ready:0,day:0,cut:0,mo:1});compute()");
|
||||
const cash=ev('S.cash');ev("ACT.setChCount({id:'f2',o:'zr4',n:3})");assert.equal(ev('S.cash'),cash,'spares are used first');assert.equal(ev('S.spares.zr4'),0);
|
||||
// decommissioning a POP returns the optics of every link it takes with it
|
||||
ev("S.pops.lon={...S.pops.fra};S.links.push({id:'f3',a:'lon',b:'ams',kind:'df',own:true,sys:'roadm',km:400,ch:['tp16','tp16'],ready:0,day:0,cut:0,mo:1});compute()");
|
||||
ev("decommission(['lon'])");
|
||||
assert.equal(ev("S.links.some(l=>l.id==='f3')"),false);assert.equal(ev('S.spares.tp16'),3);
|
||||
// a link without optics says nothing about spares
|
||||
ev("S.log=[];S.links.push({id:'f4',a:'fra',b:'ams',kind:'df',own:true,sys:'roadm',km:400,ch:[],ready:0,day:0,cut:0,mo:1});compute();ACT.rmLink({id:'f4'});ACT.rmLink({id:'f4'})");
|
||||
assert.doesNotMatch(ev("S.log.map(e=>e.t).join(' | ')"),/spares shelf/);
|
||||
assert.deepEqual(errors,[]);
|
||||
}finally{dom.window.close();}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -578,3 +578,20 @@ test('#226 the shift report\'s Open button in the NOC opens the Ops sheet, and s
|
|||
assert.ok(doc.querySelector('#modalCard .ops-rep'), 'and it is the Ops sheet with the report');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('#228 the intern names the exchanges it peered at, even one that shares its city\'s id', t => {
|
||||
const { ev, errors } = game(t, "ACT.buyIx({city:'fra',tier:0,signed:true})");
|
||||
hire(ev); on(ev, 'ix');
|
||||
ev('S.day=14'); shift(ev);
|
||||
const line = ev('opsLine(S.ops.log[0])');
|
||||
// Frankfurt's first exchange has the city's id: the line names DE-KICKS, not the city
|
||||
assert.match(line, /peered with \d+ networks? at DE-KICKS/, line);
|
||||
assert.doesNotMatch(line, /at Frankfurt/);
|
||||
// two exchanges in two cities read as two exchanges, in the daily line and in the week's report
|
||||
const e = "{i:'kevin',r:[['peer',2,['fra~3','lon']]],up:0,mo:0}";
|
||||
assert.match(ev(`opsLine(${e})`), /at Apfelwein-IX, LYNX/);
|
||||
assert.match(ev("opsWeekLine({w:2,i:'kevin',n:{peer:2},wh:{peer:['fra~3','lon']},up:0,mo:0,rev:0,ff:0})"), /at Apfelwein-IX, LYNX/);
|
||||
// other orders still name cities
|
||||
assert.match(ev("opsLine({i:'kevin',r:[['routers',1,['lon +1']]],up:0,mo:0})"), /London \+1/);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue