diff --git a/tools/challenge-helper-scripts/helpers/get-project-info.test.ts b/tools/challenge-helper-scripts/helpers/get-project-info.test.ts index a81ba30a452..4812e52d2aa 100644 --- a/tools/challenge-helper-scripts/helpers/get-project-info.test.ts +++ b/tools/challenge-helper-scripts/helpers/get-project-info.test.ts @@ -24,7 +24,7 @@ describe('getProjectPath helper', () => { describe('getProjectName helper', () => { it('should return the last path segment of the calling dir', () => { const mockCallingDir = 'calling/dir'; - const expected = `dir`; + const expected = 'dir'; // Add mock to test condition process.env.CALLING_DIR = mockCallingDir; diff --git a/tools/challenge-helper-scripts/helpers/get-project-info.ts b/tools/challenge-helper-scripts/helpers/get-project-info.ts index d136a8a7070..3dbf3c3a043 100644 --- a/tools/challenge-helper-scripts/helpers/get-project-info.ts +++ b/tools/challenge-helper-scripts/helpers/get-project-info.ts @@ -1,9 +1,7 @@ -import path from 'path'; - export function getProjectPath(): string { - return (process.env.CALLING_DIR || process.cwd()) + path.sep; + return (process.env.CALLING_DIR || process.cwd()) + '/'; } export function getProjectName(): string { - return getProjectPath().split(path.sep).slice(-2)[0]; + return getProjectPath().split('/').slice(-2)[0]; } diff --git a/tools/challenge-helper-scripts/helpers/project-metadata.test.ts b/tools/challenge-helper-scripts/helpers/project-metadata.test.ts index 39b6bac5f28..968f53a4b53 100644 --- a/tools/challenge-helper-scripts/helpers/project-metadata.test.ts +++ b/tools/challenge-helper-scripts/helpers/project-metadata.test.ts @@ -69,12 +69,18 @@ describe('getMetaData helper', () => { it('should throw if file is not found', () => { process.env.CALLING_DIR = 'curriculum/challenges/english/superblock/mick-priject'; + + const errorPath = path.join( + 'curriculum', + 'challenges', + '_meta', + 'mick-priject', + 'meta.json' + ); expect(() => { getMetaData(); }).toThrowError( - new Error( - `ENOENT: no such file or directory, open 'curriculum/challenges/_meta/mick-priject/meta.json'` - ) + new Error(`ENOENT: no such file or directory, open '${errorPath}'`) ); });