mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(api): throw during exam generation if empty config (#62044)
This commit is contained in:
@@ -303,6 +303,10 @@ export function generateExam(
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (examCopy.config.questionSets.length === 0) {
|
||||||
|
throw `${examCopy.id}: Invalid exam config - no question sets config.`;
|
||||||
|
}
|
||||||
|
|
||||||
// Convert question set config by type: [[all question sets of type], [another type], ...]
|
// Convert question set config by type: [[all question sets of type], [another type], ...]
|
||||||
const typeConvertedQuestionSetsConfig = examCopy.config.questionSets.reduce(
|
const typeConvertedQuestionSetsConfig = examCopy.config.questionSets.reduce(
|
||||||
(acc, curr) => {
|
(acc, curr) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user