mirror of
https://github.com/Matysh/houseplan-card
synced 2026-07-31 08:28:31 +00:00
- floors wizard: spaces from the HA floor registry, step-by-step with mandatory plan upload per floor, skip support, auto-markup after the last one - icon rules as data (settings.icon_rules) + in-card editor with live test, invalid-regex guard, bilingual defaults, device_class fallback chain - tap_action (card) + per-device override; security model: card-wide toggle only for light/switch/fan/humidifier, explicit override for covers, never lock/alarm; 600ms long-press always opens the info card - i18n dictionaries → src/i18n/*.json (+parity tests); light-theme badge fixes - frontend tests 15→28
28 lines
952 B
JavaScript
28 lines
952 B
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
const en = JSON.parse(readFileSync(new URL('../src/i18n/en.json', import.meta.url)));
|
|
const ru = JSON.parse(readFileSync(new URL('../src/i18n/ru.json', import.meta.url)));
|
|
|
|
test('i18n: en and ru dictionaries carry the same key set', () => {
|
|
const enKeys = Object.keys(en).sort();
|
|
const ruKeys = Object.keys(ru).sort();
|
|
assert.deepEqual(enKeys, ruKeys);
|
|
});
|
|
|
|
test('i18n: no empty values', () => {
|
|
for (const [lang, d] of [['en', en], ['ru', ru]]) {
|
|
for (const [k, v] of Object.entries(d)) {
|
|
assert.ok(typeof v === 'string' && v.length > 0, `${lang}:${k} is empty`);
|
|
}
|
|
}
|
|
});
|
|
|
|
test('i18n: placeholders match between languages', () => {
|
|
const ph = (s) => (s.match(/\{\w+\}/g) || []).sort().join(',');
|
|
for (const k of Object.keys(en)) {
|
|
assert.equal(ph(en[k]), ph(ru[k]), `placeholder mismatch in ${k}`);
|
|
}
|
|
});
|