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

pull/56140/head
Tom 2024-09-17 11:59:00 -05:00 committed by GitHub
parent 36c50c897e
commit e42683f263
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 0 deletions

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;