mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-01 17:03:30 -05:00
fix(curriculum): filter by challengeId when building blocks (#62622)
This commit is contained in:
committed by
GitHub
parent
9c31ffdf8d
commit
e1e2292b69
@@ -60,14 +60,16 @@ async function newPageContext() {
|
||||
return globalThis.__fccPuppeteerPages[poolId];
|
||||
}
|
||||
|
||||
export async function defineTestsForBlock({ block }) {
|
||||
export async function defineTestsForBlock(testFilter) {
|
||||
const lang = testedLang();
|
||||
const challenges = await getChallenges(lang, { block });
|
||||
const challenges = await getChallenges(lang, testFilter);
|
||||
const nonCertificationChallenges = challenges.filter(
|
||||
({ challengeType }) => challengeType !== 7
|
||||
);
|
||||
if (isEmpty(nonCertificationChallenges)) {
|
||||
console.warn(`No non-certification challenges to test for block ${block}.`);
|
||||
console.warn(
|
||||
`No non-certification challenges to test for block ${testFilter.block}.`
|
||||
);
|
||||
describe('Check challenges', () => {
|
||||
it('No non-certification challenges to test', () => {});
|
||||
});
|
||||
|
||||
@@ -32,17 +32,17 @@ async function main() {
|
||||
|
||||
for (const block of blocks) {
|
||||
const filePath = path.join(GENERATED_DIR, `${block}.test.js`);
|
||||
const contents = generateSingleBlockFile({ block });
|
||||
const contents = generateSingleBlockFile({ ...testFilter, block });
|
||||
await fs.promises.writeFile(filePath, contents, 'utf8');
|
||||
}
|
||||
|
||||
console.log(`Generated ${blocks.length} block test file(s).`);
|
||||
}
|
||||
|
||||
function generateSingleBlockFile({ block }) {
|
||||
function generateSingleBlockFile(testFilter) {
|
||||
return `import { defineTestsForBlock } from '../test-challenges.js';
|
||||
|
||||
await defineTestsForBlock({ block: ${JSON.stringify(block)} });
|
||||
await defineTestsForBlock(${JSON.stringify(testFilter)});
|
||||
`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user