fix(tools): use correct superblock paths (#45285)

* fix: use array of choices

* fix: capture traces from fs promise errors

* fix: use helper to get superblock subpath
This commit is contained in:
Oliver Eyton-Williams
2022-03-07 06:21:33 +01:00
committed by GitHub
parent 25c927e79b
commit 108d2460e7
3 changed files with 90 additions and 58 deletions

View File

@ -0,0 +1,15 @@
import fs from 'fs/promises';
import path from 'path';
import { SuperBlocks } from '../../config/certification-settings';
import { getSuperBlockSubPath } from './fs-utils';
describe('getSuperBlockSubPath', () => {
it('should return sub-paths that exist', async () => {
const subPaths = Object.values(SuperBlocks).map(getSuperBlockSubPath);
const paths = subPaths.map(sub =>
path.resolve(__dirname, '../../curriculum/challenges/english', sub)
);
await Promise.all(paths.map(path => fs.access(path)));
});
});