import { test } from 'node:test'
import assert from 'node:assert/strict'
import { checkAccessibilitySemantics, formatLength, localeSnapshot, supportedLocales, translate } from '../src/facade/locale'

test('locale catalog formats units and preserves long labels', () => { assert.deepEqual(supportedLocales(), ['en-US', 'zh-CN', 'de-DE']); assert.equal(translate('zh-CN', 'workspace'), '工作区'); assert.match(formatLength(12.3456, 'en-US'), /^12\.346 mm$/); assert.ok(localeSnapshot('de-DE').messages.longLabel.length > 20) })
test('accessibility semantic checker rejects unnamed or duplicate visible controls', () => { assert.equal(checkAccessibilitySemantics([{ id: 'save', role: 'button', accessibleName: 'Save', focusable: true }, { id: 'status', role: 'status', accessibleName: 'Ready' }]).pass, true); const report = checkAccessibilitySemantics([{ id: 'save', role: 'button', focusable: true }, { id: 'save', role: 'button', accessibleName: 'Save' }]); assert.equal(report.pass, false); assert.deepEqual(report.duplicateIds, ['save']); assert.deepEqual(report.unnamedFocusable, ['save']) })
