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:
@@ -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}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user