test(vscode): assert bundle keys by presence

The bundle files are parsed as string maps, so a missing key is the only
failure the test can see; checking presence says that directly.

Claude-Session: https://claude.ai/code/session_01VqV56Hez25hTxXH4ipJfzH
This commit is contained in:
Bohdan Triapitsyn
2026-09-05 14:50:08 +03:00
parent 03e14b61cd
commit 99c9f99a3d
@@ -22,10 +22,9 @@ describe('extension localization bundles', () => {
for (const file of localeFiles('l10n', 'bundle.l10n', '.json')) { for (const file of localeFiles('l10n', 'bundle.l10n', '.json')) {
const translated = readJson(file); const translated = readJson(file);
for (const [key, source] of Object.entries(english)) { for (const [key, source] of Object.entries(english)) {
const value = translated[key]; assert.ok(Object.hasOwn(translated, key), `${file} is missing the key ${JSON.stringify(key)}`);
assert.equal(typeof value, 'string', `${file} is missing the key ${JSON.stringify(key)}`);
assert.deepEqual( assert.deepEqual(
placeholders(value), placeholders(translated[key]),
placeholders(source), placeholders(source),
`${file} changes the placeholders of ${JSON.stringify(key)}` `${file} changes the placeholders of ${JSON.stringify(key)}`
); );
@@ -38,7 +37,7 @@ describe('extension localization bundles', () => {
for (const file of localeFiles('.', 'package.nls', '.json')) { for (const file of localeFiles('.', 'package.nls', '.json')) {
const translated = readJson(file); const translated = readJson(file);
for (const key of Object.keys(english)) { for (const key of Object.keys(english)) {
assert.equal(typeof translated[key], 'string', `${file} is missing the key ${key}`); assert.ok(Object.hasOwn(translated, key), `${file} is missing the key ${key}`);
} }
} }
}); });