✅(i18n) install jest and add tests
We install Jest to test our i18n package. We tests: - the extraction of the translations on the Desk app fo crowdin - the formatings of the translations from crowdin to the app - we check that all the translations are present in the app We connect the tests to the CI.
This commit is contained in:
@@ -28,7 +28,7 @@ fs.readdirSync(folderPath).map((language) => {
|
||||
const pathTranslateFile = path.join(languagePath, path.sep, namefile);
|
||||
|
||||
if (!fs.existsSync(pathTranslateFile)) {
|
||||
return;
|
||||
throw new Error(`File ${pathTranslateFile} not found!`);
|
||||
}
|
||||
|
||||
const json = JSON.parse(fs.readFileSync(pathTranslateFile, "utf8"));
|
||||
@@ -43,6 +43,10 @@ fs.readdirSync(folderPath).map((language) => {
|
||||
};
|
||||
});
|
||||
|
||||
if (!Object.keys(jsonI18n).length) {
|
||||
throw new Error(`No translation to deploy`);
|
||||
}
|
||||
|
||||
// Write the file to the output
|
||||
fs.writeFileSync(output, JSON.stringify(jsonI18n), "utf8");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user