seriesoftubes/tests/report-link.test.js
Luca 1a0a70e575
Add German translation
Series of Tubes now speaks German. site/i18n/de.js translates all 3,063
labels in informal "du". Networking terms that German engineers say in
English stay English (Peering, Transit, Dark Fiber, Wave, Port, POP, IX,
Route Server, LAG, PNI and so on); plain "fiber" is "Glasfaser" and
"fiber pair" is "Faserpaar". RouteScript syntax stays English, as in the
other languages.

German is registered in the language list and the offline cache, so a
German browser starts in German. Every per-language test now covers it,
and the German style notes are in the add-strings skill and in the
dictionary header.
2026-10-28 11:41:57 +00:00

29 lines
1.6 KiB
JavaScript

const test = require('node:test');
const assert = require('node:assert/strict');
const { load } = require('./harness');
const ISSUES = 'https://github.com/fjaeckel/seriesoftubes/issues/new/choose';
test('bugs and ideas point to GitHub from the menu and How to play, and the chat no longer asks for bug reports', () => {
for (const lang of ['en', 'it', 'pt', 'fr', 'es', 'de']) {
const { ev, errors } = load(lang === 'en' ? {} : { lang });
ev('ACT.start({})');
for (const [where, setup] of [['menu', 'ACT.menu()'], ['help', 'showHelp()']]) {
const cards = JSON.parse(ev(`(()=>{${setup};return JSON.stringify([...document.querySelectorAll('#modal a[href="${ISSUES}"]')].map(a=>[a.target,a.rel,a.textContent.trim()]));})()`));
assert.equal(cards.length, 1, `${lang}: one GitHub card in ${where}`);
assert.deepEqual(cards[0].slice(0, 2), ['_blank', 'noopener'], `${lang}: opens in a new tab`);
if (lang !== 'en') assert.doesNotMatch(cards[0][2], /Found a bug/, `${lang}: translated`);
const chat = ev(`[...document.querySelectorAll('#modal a.chat')].map(a=>a.textContent).join(' ')`);
assert.doesNotMatch(chat, /report bugs|segnala bug|reporte bugs|signale des bugs|informa de fallos/, `${lang}: the chat card is for chatting`);
}
assert.deepEqual(errors, []);
}
});
test('the GitHub card fits a phone', () => {
const { ev, errors } = load();
ev("ACT.start({});window.innerWidth=360;ACT.menu()");
assert.ok(ev('isPhone()'));
assert.ok(ev(`!!document.querySelector('#modal a.plug[href="${ISSUES}"] .go')`), 'same card layout as the chat card');
assert.deepEqual(errors, []);
});