Files
gods-eye-view/src/ui/localSdrFeedLine.i18n.test.mjs
T
German KhokhlovandClaude Opus 5.5 20f4cf3763 i18n: fix the LGTM review findings and tidy the branch texts
- i18n scanner: lastError sink, no false sinks on defaults and ternaries
- shared src/i18n/marker.js for modules that only mark strings
- wind field messages move to wind/fields.js; CITY_POIS imports from cityPois.js
- drop review IDs, change history and stale references from comments and docs

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-16 21:00:28 +04:00

59 lines
1.7 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { setLocale } from '../i18n/index.js';
import { localSdrFeedLine } from './localSdrPresentation.js';
for (const locale of ['es', 'ru']) {
test(`decoder feed line is translated in ${locale}`, () => {
setLocale(locale);
try {
const feeds = [{ id: '1090', band: '1090', status: 'live' }];
const polling = localSdrFeedLine({
configured: true,
polling: true,
feeds: [{ ...feeds[0], status: 'unreachable' }],
});
const idle = localSdrFeedLine({
configured: true,
polling: false,
feeds,
});
assert.doesNotMatch(polling, /Decoder feeds|unreachable/);
assert.match(polling, /1090/);
assert.doesNotMatch(idle, /Decoder feeds|read while Local ADS-B is on/);
assert.match(idle, /1090/);
} finally {
setLocale('en');
}
});
}
test('an unknown feed status is shown as given', () => {
setLocale('en');
const feeds = [{ band: '1090', status: 'odd' }];
assert.equal(
localSdrFeedLine({ configured: true, polling: true, feeds }),
'Decoder feeds: 1090 odd',
);
});
// A feed status agrees with "fuente" in Spanish; the shared "invalid" key
// (any other masculine noun) is left alone.
test('es: an invalid decoder feed reads "no válida"', () => {
setLocale('es');
try {
const line = localSdrFeedLine({
configured: true,
polling: true,
feeds: [
{ band: '1090', status: 'live' },
{ band: '1090', status: 'invalid' },
],
});
assert.match(line, /no válida/);
assert.doesNotMatch(line, /no válido\b/);
} finally {
setLocale('en');
}
});