diff --git a/tools/challenge-helper-scripts/create-project.ts b/tools/challenge-helper-scripts/create-project.ts index 1b435d4f100..025581ff89d 100644 --- a/tools/challenge-helper-scripts/create-project.ts +++ b/tools/challenge-helper-scripts/create-project.ts @@ -5,9 +5,11 @@ import { prompt } from 'inquirer'; import { format } from 'prettier'; import ObjectID from 'bson-objectid'; -import { SuperBlocks } from '../../shared/config/curriculum'; +import { + SuperBlocks, + superBlockToFolderMap +} from '../../shared/config/curriculum'; import { createStepFile, validateBlockName } from './utils'; -import { getSuperBlockSubPath } from './fs-utils'; import { Meta } from './helpers/project-metadata'; const helpCategories = [ @@ -141,7 +143,7 @@ async function createFirstChallenge( superBlock: SuperBlocks, block: string ): Promise { - const superBlockSubPath = getSuperBlockSubPath(superBlock); + const superBlockSubPath = superBlockToFolderMap[superBlock]; const newChallengeDir = path.resolve( __dirname, `../../curriculum/challenges/english/${superBlockSubPath}/${block}` diff --git a/tools/challenge-helper-scripts/create-quiz.ts b/tools/challenge-helper-scripts/create-quiz.ts index 4e47e70cda7..bb59585bc3a 100644 --- a/tools/challenge-helper-scripts/create-quiz.ts +++ b/tools/challenge-helper-scripts/create-quiz.ts @@ -5,9 +5,11 @@ import { prompt } from 'inquirer'; import { format } from 'prettier'; import ObjectID from 'bson-objectid'; -import { SuperBlocks } from '../../shared/config/curriculum'; +import { + SuperBlocks, + superBlockToFolderMap +} from '../../shared/config/curriculum'; import { createQuizFile, validateBlockName } from './utils'; -import { getSuperBlockSubPath } from './fs-utils'; import { Meta } from './helpers/project-metadata'; const helpCategories = [ @@ -135,7 +137,7 @@ async function createQuizChallenge( title: string, questionCount: number ): Promise { - const superBlockSubPath = getSuperBlockSubPath(superBlock); + const superBlockSubPath = superBlockToFolderMap[superBlock]; const newChallengeDir = path.resolve( __dirname, `../../curriculum/challenges/english/${superBlockSubPath}/${block}` diff --git a/tools/challenge-helper-scripts/fs-utils.test.ts b/tools/challenge-helper-scripts/fs-utils.test.ts deleted file mode 100644 index d1dd2f8a759..00000000000 --- a/tools/challenge-helper-scripts/fs-utils.test.ts +++ /dev/null @@ -1,15 +0,0 @@ -import fs from 'fs/promises'; -import path from 'path'; -import { SuperBlocks } from '../../shared/config/curriculum'; -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))); - }); -}); diff --git a/tools/challenge-helper-scripts/fs-utils.ts b/tools/challenge-helper-scripts/fs-utils.ts deleted file mode 100644 index 0ddfe0bcd1f..00000000000 --- a/tools/challenge-helper-scripts/fs-utils.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { - SuperBlocks, - superBlockToFolderMap -} from '../../shared/config/curriculum'; - -export function getSuperBlockSubPath(superBlock: SuperBlocks): string { - return superBlockToFolderMap[superBlock]; -}