1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2025-05-18 12:02:53 +02:00

test(cli): add commands/generate/solution

This commit is contained in:
Divlo
2021-12-06 16:35:45 +01:00
parent ee6733c760
commit 249bb3a367
3 changed files with 124 additions and 7 deletions

View File

@ -67,7 +67,7 @@ export class Solution implements SolutionOptions {
const { name, challengeName, programmingLanguageName, githubUser } = options
const challenge = new Challenge({ name: challengeName })
if (!(await isExistingPath(challenge.path))) {
throw new Error(`The challenge doesn't exist yet: ${name}.`)
throw new Error(`The challenge doesn't exist yet: ${challenge.name}.`)
}
const solution = new Solution({
name,
@ -75,7 +75,7 @@ export class Solution implements SolutionOptions {
programmingLanguageName
})
if (await isExistingPath(solution.path)) {
throw new Error('The solution already exists.')
throw new Error(`The solution already exists: ${name}.`)
}
await template.solution({
challengeName: challenge.name,