feat(curriculum-tests): check that ObjectId filenames match challenge ID (#56138)

This commit is contained in:
Tom
2024-09-17 11:59:00 -05:00
committed by GitHub
parent 36c50c897e
commit e42683f263
+10
View File
@@ -276,6 +276,16 @@ function generateChallengeCreator(lang, englishPath, i18nPath) {
({ id }) => id === challenge.id
);
const isObjectIdFilename = /[a-z0-9]{24}\.md$/.test(englishPath);
if (isObjectIdFilename) {
const filename = englishPath.split('/').pop();
if (filename !== `${challenge.id}.md`) {
throw Error(
`Filename ${filename} does not match challenge id ${challenge.id}`
);
}
}
challenge.block = meta.dashedName;
challenge.blockType = meta.blockType;
challenge.hasEditableBoundaries = !!meta.hasEditableBoundaries;