import assert from 'node:assert/strict'; import test from 'node:test'; import { inferEditorLocaleFromSystem, normalizeEditorLocale } from './editorMessages'; void test('inferEditorLocaleFromSystem: en-* wins when listed first', () => { assert.equal(inferEditorLocaleFromSystem(['en-GB', 'ru-RU']), 'en'); }); void test('inferEditorLocaleFromSystem: ru-* wins when listed first', () => { assert.equal(inferEditorLocaleFromSystem(['ru-RU', 'en-US']), 'ru'); }); void test('inferEditorLocaleFromSystem: unknown tags fall back to ru', () => { assert.equal(inferEditorLocaleFromSystem(['de-DE', 'fr']), 'ru'); }); void test('inferEditorLocaleFromSystem: empty list → ru', () => { assert.equal(inferEditorLocaleFromSystem([]), 'ru'); }); void test('normalizeEditorLocale: trims stored en/ru', () => { assert.equal(normalizeEditorLocale(' EN '), 'en'); assert.equal(normalizeEditorLocale('ru '), 'ru'); }); void test('normalizeEditorLocale: blank or invalid defers to infer (explicit list)', () => { assert.equal(normalizeEditorLocale(''), inferEditorLocaleFromSystem([])); assert.equal(normalizeEditorLocale('xx'), inferEditorLocaleFromSystem([])); });