fix(tools): update challege formatting check
This commit is contained in:
committed by
mrugesh
parent
3ec1fe8ea7
commit
31f337f2bd
@ -41,6 +41,7 @@ function getSchemaForLang(lang) {
|
|||||||
),
|
),
|
||||||
guideUrl: Joi.string().uri({ scheme: 'https' }),
|
guideUrl: Joi.string().uri({ scheme: 'https' }),
|
||||||
videoUrl: Joi.string().allow(''),
|
videoUrl: Joi.string().allow(''),
|
||||||
|
forumTopicId: Joi.number(),
|
||||||
helpRoom: Joi.string(),
|
helpRoom: Joi.string(),
|
||||||
id: Joi.objectId().required(),
|
id: Joi.objectId().required(),
|
||||||
instructions: Joi.string().allow(''),
|
instructions: Joi.string().allow(''),
|
||||||
|
@ -51,21 +51,26 @@ const challengeFrontmatterValidator = file => frontmatter => {
|
|||||||
|
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { videoUrl } = frontmatter;
|
const { videoUrl } = frontmatter;
|
||||||
|
|
||||||
let validVideoUrl = false;
|
let validVideoUrl = false;
|
||||||
if (isEmpty(videoUrl)) {
|
if (!isEmpty(videoUrl) && !scrimbaUrlRE.test(videoUrl)) {
|
||||||
validVideoUrl = true;
|
validVideoUrl = true;
|
||||||
} else {
|
console.log(`
|
||||||
validVideoUrl = scrimbaUrlRE.test(videoUrl);
|
${fullPath} contains an invalid videoUrl
|
||||||
|
`);
|
||||||
if (!validVideoUrl) {
|
|
||||||
console.log(`
|
|
||||||
${fullPath} contains an invalid videoUrl
|
|
||||||
`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return hasRequiredProperties && validVideoUrl;
|
|
||||||
|
const { forumTopicId } = frontmatter;
|
||||||
|
let validForumTopicId = false;
|
||||||
|
if (!isEmpty(forumTopicId) && !isNumber(forumTopicId)) {
|
||||||
|
validForumTopicId = true;
|
||||||
|
console.log(`
|
||||||
|
${fullPath} contains an invalid forumTopicId
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return hasRequiredProperties && validVideoUrl && validForumTopicId;
|
||||||
};
|
};
|
||||||
|
|
||||||
function isChallengeParseable(file) {
|
function isChallengeParseable(file) {
|
||||||
|
Reference in New Issue
Block a user