mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
test(external curricula): run test on all chapters and modules (#60913)
This commit is contained in:
@@ -224,38 +224,26 @@ ${result.error.message}`);
|
|||||||
superBlock
|
superBlock
|
||||||
] as ChapterBasedCurriculumIntros[SuperBlocks];
|
] as ChapterBasedCurriculumIntros[SuperBlocks];
|
||||||
|
|
||||||
// Randomly pick a chapter.
|
|
||||||
const chapters = superBlockData.chapters.filter(
|
|
||||||
({ comingSoon }) => !comingSoon
|
|
||||||
);
|
|
||||||
const randomChapterIndex = Math.floor(Math.random() * chapters.length);
|
|
||||||
const randomChapter = chapters[randomChapterIndex];
|
|
||||||
|
|
||||||
// Randomly pick a module.
|
|
||||||
const modules = randomChapter.modules.filter(
|
|
||||||
({ comingSoon }) => !comingSoon
|
|
||||||
);
|
|
||||||
const randomModuleIndex = Math.floor(Math.random() * modules.length);
|
|
||||||
const randomModule = modules[randomModuleIndex];
|
|
||||||
|
|
||||||
// Randomly pick a block.
|
|
||||||
// const blocks = randomModule.blocks;
|
|
||||||
// const randomBlockIndex = Math.floor(Math.random() * blocks.length);
|
|
||||||
// const randomBlock = blocks[randomBlockIndex];
|
|
||||||
|
|
||||||
// Check super block data
|
// Check super block data
|
||||||
expect(superBlockData.intro).toEqual(superBlockIntros.intro);
|
expect(superBlockData.intro).toEqual(superBlockIntros.intro);
|
||||||
|
|
||||||
// Check chapter data
|
// Loop through all chapters
|
||||||
expect(superBlockData.chapters[randomChapterIndex].name).toEqual(
|
superBlockData.chapters
|
||||||
superBlockIntros.chapters[randomChapter.dashedName]
|
.filter(({ comingSoon }) => !comingSoon)
|
||||||
);
|
.forEach(chapter => {
|
||||||
|
expect(chapter.name).toEqual(
|
||||||
|
superBlockIntros.chapters[chapter.dashedName]
|
||||||
|
);
|
||||||
|
|
||||||
// Check module data
|
// Loop through all modules in the chapter
|
||||||
expect(
|
chapter.modules
|
||||||
superBlockData.chapters[randomChapterIndex].modules[randomModuleIndex]
|
.filter(({ comingSoon }) => !comingSoon)
|
||||||
.name
|
.forEach(module => {
|
||||||
).toEqual(superBlockIntros.modules[randomModule.dashedName]);
|
expect(module.name).toEqual(
|
||||||
|
superBlockIntros.modules[module.dashedName]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Temporary skip these checks to keep CI stable.
|
// Temporary skip these checks to keep CI stable.
|
||||||
// TODO: uncomment these once https://github.com/freeCodeCamp/freeCodeCamp/issues/60660 is completed.
|
// TODO: uncomment these once https://github.com/freeCodeCamp/freeCodeCamp/issues/60660 is completed.
|
||||||
|
|||||||
Reference in New Issue
Block a user