From 99c9f99a3d1defa588f4c318961839bcfa29e135 Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Sat, 5 Sep 2026 14:50:08 +0300 Subject: [PATCH] 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 --- packages/vscode/src/localizationBundles.test.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/vscode/src/localizationBundles.test.ts b/packages/vscode/src/localizationBundles.test.ts index 45a31c07..78a31922 100644 --- a/packages/vscode/src/localizationBundles.test.ts +++ b/packages/vscode/src/localizationBundles.test.ts @@ -22,10 +22,9 @@ describe('extension localization bundles', () => { for (const file of localeFiles('l10n', 'bundle.l10n', '.json')) { const translated = readJson(file); for (const [key, source] of Object.entries(english)) { - const value = translated[key]; - assert.equal(typeof value, 'string', `${file} is missing the key ${JSON.stringify(key)}`); + assert.ok(Object.hasOwn(translated, key), `${file} is missing the key ${JSON.stringify(key)}`); assert.deepEqual( - placeholders(value), + placeholders(translated[key]), placeholders(source), `${file} changes the placeholders of ${JSON.stringify(key)}` ); @@ -38,7 +37,7 @@ describe('extension localization bundles', () => { for (const file of localeFiles('.', 'package.nls', '.json')) { const translated = readJson(file); 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}`); } } });