import {test} from 'node:test';import assert from 'node:assert/strict';import {translate} from '../src/languageDictionary.mjs'; const dictionary={common:{Name:'Name',Speichern:'Save'},sources:{'admin/menu.php':{Aufträge:'Jobs',Leer:''},'admin/other.php':{Aufträge:'Orders',Leer:'Other'}}}; test('page meanings take priority; missing and explicitly empty translations preserve German',()=>{ assert.equal(translate(dictionary,'Aufträge',['admin/menu.php']),'Jobs');assert.equal(translate(dictionary,'Aufträge',['admin/other.php']),'Orders');assert.equal(translate(dictionary,'Aufträge'),'Aufträge');assert.equal(translate(dictionary,'Leer',['admin/menu.php']),'Leer');assert.equal(translate(dictionary,'Speichern',['missing']),'Save');assert.equal(translate(null,'Speichern'),'Speichern'); }); test('inline whitespace and object-looking labels remain literal',()=>{ assert.equal(translate(dictionary,' Speichern\u00a0'),' Save\u00a0');assert.equal(translate(dictionary,'constructor'),'constructor');assert.equal(translate(dictionary,'__proto__'),'__proto__');assert.equal(translate(dictionary,'Kundenname Speichern'),'Kundenname Speichern');assert.equal(translate(dictionary,'Save'),'Save'); });