🚢 ${esc
function layPanel(l){const d=S.day,st=layStart(l),q=layQuote(l),km=Math.round(layDone(l,d)*l.km),two=l.ship2?tr('cable_ships.ship_and_ship',{a:layName(l),b:layName(l,1)}):layName(l);
let h=d ${tr('link_panels.only_a_few_dozen_cable_ships')}
Laying your cable from {a} to {b}: {km} of {of} km on the seabed.",
"cable_ships.laying_starts_in_n_days":{"one":"Laying starts in {n} day","other":"Laying starts in {n} days"},
+"cable_ships.money_only_goes_so_far":"Lawyers and overtime only go so far: the cable still has to be made. For this one that is {n} days from the order at the soonest, then the ships sail.",
"cable_ships.private_at_anchor":"at anchor off {home}, for charter to anyone who pays.",
"cable_ships.private_operator":"Private operator",
"cable_ships.sailing_home_to_home":{"one":"sailing home to {home}, free again in {n} day.","other":"sailing home to {home}, free again in {n} days."},
@@ -440,6 +443,7 @@
"cable_ships.ship_waits_for_a_permit":"{ship} is on site, waiting {n}d for a repair permit. Cable back in about {m}d.",
"cable_ships.ships_lay_the_cable":"{ships} at sea, laying",
"cable_ships.survey_permits_and_the_cable_factory":"Survey, permits and the cable factory",
+"cable_ships.the_factory_runs_a_night_shift":{"one":"The permit lawyers found a stamp and the factory runs a night shift: laying starts {n} day sooner.","other":"The permit lawyers found a stamp and the factory runs a night shift: laying starts {n} days sooner."},
"cables.a_bet_on_a_tiny_island":"A bet on a tiny island in the middle of the Pacific.",
"cables.a_buffet_of_landings_down_norway":"A buffet of landings down the Norwegian coast, from the oil fields to Oslo.",
"cables.a_friendly_cable_with_french_manners":"A friendly cable with French manners.",
diff --git a/tests/mcp-commands.test.js b/tests/mcp-commands.test.js
index 566da68..5c336ce 100644
--- a/tests/mcp-commands.test.js
+++ b/tests/mcp-commands.test.js
@@ -225,7 +225,7 @@ test('a dry run prices every command that has a price, and changes nothing', ()
crews: { id: df }, addCh: { id: df, o: 'zr4' }, addPair: { id: df }, upSys: { id: df }, regen: { id: df, d: 1 }, buySpare: { o: 'zr4' }, sellSpare: { o: 'zr4' },
setChCount: { id: df, o: 'zr4', n: 2 }, repayLoan: { id: 'none' }, buildScrub: { city: 'ams', tier: 1 }, scrubUp: { city: 'fra', tier: 1 },
fixInc: { id: 'none' }, confGo: { key: T('catalog', { name: 'conferences' })[0].key }, confSponsor: { key: T('catalog', { name: 'conferences' })[0].key },
- opsHire: { id: ev('Object.keys(INTERNS)[0]') }, opsNewPop: { city: 'nyc' }, pniAll: { net: 'cog', tier: 1 }, seatBuy: { n: 2 }, layShip: { id: df },
+ opsHire: { id: ev('Object.keys(INTERNS)[0]') }, opsNewPop: { city: 'nyc' }, pniAll: { net: 'cog', tier: 1 }, seatBuy: { n: 2 }, layShip: { id: df }, seaRush: { id: df },
utilityKit: { city: 'fra' }, utilityCaches: { city: 'fra' }, teDeploy: { script: 'spill at 85%' }, upLinkX: {},
};
const missing = quoted.filter((n) => !sample[n] && T('schema', { section: 'commands' })[n].args.some((a) => a.required));
diff --git a/tests/pages.test.js b/tests/pages.test.js
index 3d0a74b..2db014d 100644
--- a/tests/pages.test.js
+++ b/tests/pages.test.js
@@ -78,7 +78,9 @@ test('pages: the shipped page and dictionaries, with labels shrunk to ids, still
for (const [lang, word] of [['en', 'Customers'], ['it', 'Clienti'], ['fr', null]]) {
const { ev, errors } = load(lang === 'en' ? { file } : { file, lang, dir });
ev("ACT.start({});S.cash=1e8;ACT.launchBB({city:'fra'});for(let i=0;i<40;i++)dayTick();ACT.leftTab({t:'noc'});renderAll()");
- const text = ev("['hud','leftBody','panelBody','modalCard','toasts'].map(i=>document.getElementById(i)?.textContent||'').join(' ')");
+ // Text node by text node: a raw label sits inside one, while two elements' text run together ("facendo." then
+ // "proprio ora") only looks like one.
+ const text = ev("['hud','leftBody','panelBody','modalCard','toasts'].map(i=>{const e=document.getElementById(i);if(!e)return '';const w=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),out=[];while(w.nextNode())out.push(w.currentNode.nodeValue);return out.join(' ');}).join(' ')");
if (word) assert.ok(text.includes(word), `${lang}: ${word}`);
assert.doesNotMatch(text, /\b[a-z_]+\.[a-z0-9_]{6,}\b/, `${lang}: no raw labels`);
assert.equal(ev("tr(FLOOD_WHO[0])"), ev("tr('failures.a_botnet_of_40_000_smart')"), `${lang}: labels kept for saves still translate`);
diff --git a/tests/sea-rush.test.js b/tests/sea-rush.test.js
new file mode 100644
index 0000000..77f8afe
--- /dev/null
+++ b/tests/sea-rush.test.js
@@ -0,0 +1,51 @@
+// #258: money hurries the survey, permits and factory of your own subsea cable, 30 days a step, but never below what the
+// factory needs to make the cable (two months plus a day per 80 km); the lay ships still sail after that.
+const test = require('node:test');
+const assert = require('node:assert/strict');
+const { load } = require('./harness');
+
+const start = "ACT.start({});S.cash=1e9;S.lvl=13;S.day=200;S.nextFail=S.nextEvent=1e8;for(const g of GOALS)S.done[g.id]=0;";
+const own = (km, ready) => `S.links=[{id:'own',a:'lag',b:'bde',kind:'df',own:true,sub:true,sys:'roadm',km:${km},ch:[],day:200,ready:${ready},cut:0,mo:1}];`;
+
+test('#258 paying hurries the permits and the factory, 30 days a step, down to what the factory needs', () => {
+ const { ev, dom, errors } = load();
+ ev(start + own(6000, 800));
+ // 6000 km: 60 + 72 days to make it, then 40 days at sea.
+ assert.equal(ev('prepMin(S.links[0])'), 132);
+ assert.equal(ev('prepFloor(S.links[0])'), 200 + 132 + 40);
+ assert.equal(ev('prepSteps(S.links[0])'), 15);
+ ev("UI.sel={type:'link',id:'own'};renderPanel()");
+ const panel = () => dom.window.document.querySelector('#panelBody').textContent;
+ assert.match(panel(), /Hurry the permits and the factory/);
+ assert.match(panel(), /As fast as money goes/);
+ assert.match(panel(), /132 days from the order at the soonest/);
+ const step = ev('prepCost(S.links[0])'), cash = ev('S.cash');
+ ev("ACT.seaRush({id:'own'})");
+ assert.equal(ev('S.links[0].ready'), 770, 'one step: 30 days sooner');
+ assert.equal(cash - ev('S.cash'), step);
+ ev("ACT.seaRush({id:'own',all:1})");
+ assert.equal(ev('S.links[0].ready'), 372, 'all the way: the factory floor, then the ships');
+ assert.equal(cash - ev('S.cash'), 15 * step);
+ assert.equal(ev('layStart(S.links[0])'), 332);
+ assert.equal(ev('prepSteps(S.links[0])'), 0, 'no faster than that');
+ ev("ACT.seaRush({id:'own'})");
+ assert.equal(cash - ev('S.cash'), 15 * step, 'and nothing more is charged');
+ // The second lay ship still halves the time at sea on top.
+ ev("ACT.layShip({id:'own'})");
+ assert.equal(ev('S.links[0].ready'), 352);
+ assert.deepEqual(errors, []);
+});
+
+test('#258 a short cable is quick; once the ships sail, money buys no more paperwork', () => {
+ const { ev, errors } = load();
+ ev(start + own(800, 600));
+ assert.equal(ev('prepMin(S.links[0])'), 70, 'a short hop: a couple of months');
+ ev("ACT.seaRush({id:'own',all:1})");
+ assert.equal(ev('S.links[0].ready'), 200 + 70 + 6);
+ ev(start + own(6000, 800) + 'S.day=770');
+ assert.equal(ev('prepSteps(S.links[0])'), 0, 'laying has started');
+ const cash = ev('S.cash');
+ ev("ACT.seaRush({id:'own'})");
+ assert.equal(ev('S.cash'), cash);
+ assert.deepEqual(errors, []);
+});