mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 02:44:33 +03:00
Improved i18n tests to include commits with missing i18n.js entries (#21175)
no ref We've had several PRs for new locales that forgot to update i18n.js, which causes them not to get regenerated by yarn translate. This PR checks for that error, and also the reverse one where they update i18n but we're missing folders. (Never expected to error, because 'yarn test' is defined to include 'yarn translate', which generates the folders.)
This commit is contained in:
parent
6e599ef541
commit
b9547cc120
@ -69,4 +69,25 @@ describe('i18n', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('directories and locales in i18n.js will match', function () {
|
||||
it('should have a key for each directory in the locales directory', async function () {
|
||||
const locales = await fs.readdir(path.join(__dirname, '../locales'));
|
||||
const supportedLocales = i18n.SUPPORTED_LOCALES;
|
||||
|
||||
for (const locale of locales) {
|
||||
if (locale !== 'context.json') {
|
||||
assert(supportedLocales.includes(locale), `The locale ${locale} is not in the list of supported locales`);
|
||||
}
|
||||
}
|
||||
});
|
||||
it('should have a directory for each key in lib/i18n.js', async function () {
|
||||
const supportedLocales = i18n.SUPPORTED_LOCALES;
|
||||
|
||||
for (const locale of supportedLocales) {
|
||||
const localeDir = path.join(__dirname, `../locales/${locale}`);
|
||||
const stats = await fs.stat(localeDir);
|
||||
assert(stats.isDirectory(), `The locale ${locale} does not have a directory`);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user