fix: make sure ext curriculum tests fail if missing meta (#61904)

This commit is contained in:
Oliver Eyton-Williams
2025-08-21 19:57:45 +02:00
committed by GitHub
parent b246d99b30
commit efe3d22b06
3 changed files with 134 additions and 116 deletions

View File

@@ -72,14 +72,18 @@ ${result.error.message}`
await readdirp.promise(`${clientStaticPath}/curriculum-data/${VERSION}`, {
directoryFilter: ['!challenges'],
fileFilter: entry => {
// path without extension:
const filePath = entry.path.replace(/\.json$/, '');
// The directory contains super block files and other curriculum-related files.
// We're only interested in super block ones.
const superBlocks = Object.values(SuperBlocks);
return superBlocks.includes(entry.basename);
return superBlocks.includes(filePath);
}
})
).map(file => file.path);
expect(fileArray.length).toBeGreaterThan(0);
fileArray.forEach(fileInArray => {
const fileContent = fs.readFileSync(
`${clientStaticPath}/curriculum-data/${VERSION}/${fileInArray}`,
@@ -100,14 +104,18 @@ ${result.error.message}`);
await readdirp.promise(`${clientStaticPath}/curriculum-data/${VERSION}`, {
directoryFilter: ['!challenges'],
fileFilter: entry => {
// path without extension:
const filePath = entry.path.replace(/\.json$/, '');
// The directory contains super block files and other curriculum-related files.
// We're only interested in super block ones.
const superBlocks = Object.values(SuperBlocks);
return superBlocks.includes(entry.basename);
return superBlocks.includes(filePath);
}
})
).map(file => file.path);
expect(superBlockFiles.length).toBeGreaterThan(0);
superBlockFiles.forEach(file => {
const fileContentJson = fs.readFileSync(
`${clientStaticPath}/curriculum-data/${VERSION}/${file}`,