mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
chore(curriculum, tools): improve external curricula data validation (#59541)
This commit is contained in:
@@ -88,4 +88,16 @@ ${result.error.message}`);
|
||||
publicSuperBlockNames.length
|
||||
);
|
||||
});
|
||||
|
||||
test('challenge files should be created and in the correct directory', () => {
|
||||
expect(
|
||||
fs.existsSync(`${clientStaticPath}/curriculum-data/${VERSION}/challenges`)
|
||||
).toBe(true);
|
||||
|
||||
expect(
|
||||
fs.readdirSync(
|
||||
`${clientStaticPath}/curriculum-data/${VERSION}/challenges`
|
||||
).length
|
||||
).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,11 +3,11 @@ const Joi = require('joi');
|
||||
const blockSchema = Joi.object({}).keys({
|
||||
desc: Joi.array().min(1),
|
||||
challenges: Joi.object({}).keys({
|
||||
name: Joi.string(),
|
||||
isUpcomingChange: Joi.bool(),
|
||||
name: Joi.string().required(),
|
||||
isUpcomingChange: Joi.bool().required(),
|
||||
usesMultifileEditor: Joi.bool().optional(),
|
||||
hasEditableBoundaries: Joi.bool().optional(),
|
||||
dashedName: Joi.string(),
|
||||
dashedName: Joi.string().required(),
|
||||
helpCategory: Joi.valid(
|
||||
'JavaScript',
|
||||
'HTML-CSS',
|
||||
@@ -18,13 +18,25 @@ const blockSchema = Joi.object({}).keys({
|
||||
'Odin',
|
||||
'Euler',
|
||||
'Rosetta'
|
||||
),
|
||||
order: Joi.number(),
|
||||
time: Joi.string().allow(''),
|
||||
).required(),
|
||||
order: Joi.number().when('superBlock', {
|
||||
is: 'full-stack-developer',
|
||||
then: Joi.forbidden(),
|
||||
otherwise: Joi.required()
|
||||
}),
|
||||
template: Joi.string().allow(''),
|
||||
required: Joi.array(),
|
||||
superBlock: Joi.string(),
|
||||
blockLayout: Joi.string(),
|
||||
superBlock: Joi.string().required(),
|
||||
blockLayout: Joi.valid(
|
||||
'challenge-list',
|
||||
'challenge-grid',
|
||||
'dialogue-grid',
|
||||
'link',
|
||||
'project-list',
|
||||
'legacy-challenge-list',
|
||||
'legacy-link',
|
||||
'legacy-challenge-grid'
|
||||
).required(),
|
||||
blockType: Joi.valid(
|
||||
'lecture',
|
||||
'workshop',
|
||||
@@ -32,7 +44,11 @@ const blockSchema = Joi.object({}).keys({
|
||||
'review',
|
||||
'quiz',
|
||||
'exam'
|
||||
),
|
||||
).when('superBlock', {
|
||||
is: 'full-stack-developer',
|
||||
then: Joi.required(),
|
||||
otherwise: Joi.optional()
|
||||
}),
|
||||
challengeOrder: Joi.array().items(
|
||||
Joi.object({}).keys({
|
||||
id: Joi.string(),
|
||||
|
||||
Reference in New Issue
Block a user