DE-KICKS: hidden prices, haggling, harmonisation, auto-enrolled add-ons, retention offers
This commit is contained in:
parent
22bdaf9f9b
commit
507fe70e25
4 changed files with 105 additions and 14 deletions
|
|
@ -25,7 +25,7 @@ test('a year of scripted play stays healthy', () => {
|
|||
const { ev, errors } = load();
|
||||
seed(ev, 7);
|
||||
ev("ACT.start({})");
|
||||
ev("ACT.launchBB({city:'fra'});ACT.buyTransit({city:'fra',net:'cog',tier:1});ACT.buyIx({city:'fra',tier:1});ACT.rs({city:'fra'})");
|
||||
ev("ACT.launchBB({city:'fra'});ACT.buyTransit({city:'fra',net:'cog',tier:1});ACT.buyIx({city:'fra',tier:1,signed:true});ACT.rs({city:'fra'})");
|
||||
ev("UI.pending={a:'fra',b:'ams'};ACT.buildLink({tier:1});ACT.launchBB({city:'ams'})");
|
||||
for (let d = 0; d < 360; d++) {
|
||||
ev('dayTick()');
|
||||
|
|
@ -43,7 +43,7 @@ test('every incident and event type fires and clears cleanly', () => {
|
|||
seed(ev, 3);
|
||||
ev("ACT.start({});S.cash=1e8;S.lvl=4;S.day=100");
|
||||
ev("for(const c of ['ams','lon','nyc','mos','mnl'])ACT.buildPop({city:c})");
|
||||
ev("ACT.launchBB({city:'fra'});ACT.buyTransit({city:'fra',net:'cog',tier:1});ACT.buyIx({city:'fra',tier:1});ACT.rs({city:'fra'})");
|
||||
ev("ACT.launchBB({city:'fra'});ACT.buyTransit({city:'fra',net:'cog',tier:1});ACT.buyIx({city:'fra',tier:1,signed:true});ACT.rs({city:'fra'})");
|
||||
ev("UI.pending={a:'fra',b:'ams'};ACT.buildLink({tier:1});UI.via='grace';openLinkModal('nyc','lon');ACT.buildLink({tier:1});closeModal()");
|
||||
ev("UI.pending={a:'fra',b:'ams'};UI.lmode='df';UI.dfSys='roadm';ACT.orderDf();UI.lmode='wave';S.pops.fra.rgen=2;S.pops.ams.rgen=2");
|
||||
ev("const df=S.links.find(l=>l.kind==='df');ACT.addCh({id:df.id,o:'zr4'});df.ready=S.day");
|
||||
|
|
@ -97,7 +97,7 @@ test('saves never resurrect a bankrupt game', () => {
|
|||
test('LAGs add members, capacity and cost to transit, IX ports and PNIs', () => {
|
||||
const { ev, errors } = load();
|
||||
ev("ACT.start({});S.cash=1e7;S.lvl=4;S.pops.fra.rgen=2;for(const g of GOALS)S.done[g.id]=0");
|
||||
ev("ACT.buyTransit({city:'fra',net:'cog',tier:1});ACT.buyIx({city:'fra',tier:1})");
|
||||
ev("ACT.buyTransit({city:'fra',net:'cog',tier:1});ACT.buyIx({city:'fra',tier:1,signed:true})");
|
||||
ev("const t=S.transit[0];window.__c0=S.cash;ACT.lagT({id:t.id,d:1});ACT.lagT({id:t.id,d:1});ACT.lagIx({city:'fra',d:1});compute()");
|
||||
assert.equal(ev('S.transit[0].n'), 3);
|
||||
assert.equal(ev("S.ixn.fra"), 2);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ test('a snubbing peer tears down an existing session and the Request button expl
|
|||
assert.ok(k, 'found a snub starting at an IX');
|
||||
const [id, c, d] = k.split('@');
|
||||
ev(`S.day=${d}`);
|
||||
ev(`ACT.buildPop({city:'${c}'});ACT.buyIx({city:'${c}',tier:1});S.peers['${id}@${c}']=true;compute()`);
|
||||
ev(`ACT.buildPop({city:'${c}'});ACT.buyIx({city:'${c}',tier:1,signed:true});S.peers['${id}@${c}']=true;compute()`);
|
||||
assert.equal(ev(`ixSessions('${c}').has('${id}')`), true);
|
||||
ev('dayTick()');
|
||||
assert.equal(ev(`!!S.peers['${id}@${c}']`), false, 'session torn down');
|
||||
|
|
@ -58,7 +58,7 @@ test('remote peering is offered but costs more, gives less and gets refused more
|
|||
assert.equal(ev("isRemote('ams')"), true);
|
||||
assert.equal(ev("ixPortMo('ams',1)"), ev("Math.round(PORT[1].ix*1.5)"), 'reseller markup');
|
||||
assert.equal(ev("ixCap('ams')"), ev("PORT[1].g*0.8"), 'oversubscribed port');
|
||||
const refusers = JSON.parse(ev("JSON.stringify(ixMembers('ams').filter(noRemote))"));
|
||||
const refusers = JSON.parse(ev("JSON.stringify(ixMembers('ams').filter(id=>noRemote(id)&&!snub(id,'ams')))"));
|
||||
assert.ok(refusers.length > 0, 'some members refuse remote peers');
|
||||
const r = JSON.parse(ev(`JSON.stringify(peerOk('${refusers[0]}','ix','ams'))`));
|
||||
assert.equal(r.ok, false); assert.equal(r.remote, true);
|
||||
|
|
@ -72,3 +72,44 @@ test('remote peering is offered but costs more, gives less and gets refused more
|
|||
assert.equal(ev(`peerOk('${refusers[0]}','ix','ams').remote`), undefined);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('DE-KICKS hides prices, haggles, harmonises upwards, auto-enrolls add-ons and fights to keep you', () => {
|
||||
const { ev, errors } = load();
|
||||
setup(ev);
|
||||
ev("selectCity('fra');ACT.tab({t:'peer'})");
|
||||
assert.match(ev("document.getElementById('panelBody').textContent"), /Price on request/);
|
||||
ev("ACT.buyIx({city:'fra',tier:1})");
|
||||
assert.equal(ev("S.ixp.fra===undefined"), true, 'no port without signing');
|
||||
assert.match(ev("document.getElementById('modalCard').textContent"), /Confidential/);
|
||||
ev("S.dk.q.m=1.5;ACT.dkAccept()");
|
||||
assert.equal(ev("S.ixp.fra"), 1);
|
||||
assert.equal(ev("ixPortMo('fra',1)"), ev("Math.round(PORT[1].ix*1.5)"));
|
||||
// haggling always moves something
|
||||
ev("S.dk.q={city:'mad',tier:1,m:1.5,h:0}");
|
||||
for (let i = 0; i < 3; i++) ev("if(S.dk.q)ACT.dkHaggle()");
|
||||
assert.ok(ev("!S.dk.q||S.dk.q.m!==1.5||S.dk.stall>S.day"));
|
||||
// yearly harmonisation
|
||||
const m0 = ev("S.dk.m.fra");
|
||||
ev("let n=0;while(n++<400){S.day++;if((S.day+hstr('fra')%90)%365===0)break;}S.day--;dkTick(S.day+1)");
|
||||
assert.ok(ev("S.dk.m.fra") > m0, 'price went up');
|
||||
// add-ons show up on the invoice until you opt out (twice)
|
||||
ev("S.dk.add.fra=[{n:'Route Server Gold',blurb:'gold',mo:500,day:S.day}]");
|
||||
assert.equal(ev("dkAddonMo('fra')"), 500);
|
||||
ev("selectCity('fra');ACT.tab({t:'peer'})");
|
||||
assert.match(ev("document.getElementById('panelBody').textContent"), /auto-enrolled/);
|
||||
ev("ACT.dkOptOut({city:'fra',n:'Route Server Gold'})");
|
||||
assert.equal(ev("S.dk.add.fra.length"), 1, 'first click only asks');
|
||||
ev("ACT.dkOptOut({city:'fra',n:'Route Server Gold'})");
|
||||
assert.equal(ev("S.dk.add.fra.length"), 0);
|
||||
// leaving: a retention offer first
|
||||
ev("ACT.cancelIx({city:'fra'});ACT.cancelIx({city:'fra'})");
|
||||
assert.match(ev("document.getElementById('modalCard').textContent"), /Before you go/);
|
||||
const full = ev("ixPortMo('fra',1)");
|
||||
ev("ACT.dkStay({city:'fra'})");
|
||||
assert.ok(ev("ixPortMo('fra',1)") < full, 'promo price');
|
||||
ev("ACT.cancelIx({city:'fra'});ACT.cancelIx({city:'fra'})");
|
||||
assert.equal(ev("S.ixp.fra"), undefined, 'second time you can actually leave');
|
||||
ev("ACT.buildPop({city:'ams'})");
|
||||
assert.equal(ev("ixPortMo('ams',1)"), ev("PORT[1].ix"), 'other IXs keep open pricing');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue