Skip to content

Commit

Permalink
🎨 Make sure we return the defaulted command when testing so we can ch…
Browse files Browse the repository at this point in the history
…eck behaviour
  • Loading branch information
segersniels committed Mar 10, 2020
1 parent 9d4d2a6 commit f12c447
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,16 @@ export class Command {
// Extract the id from the choice that was made or given
const choice = await this.internal.determineChoice(choices);

// Unable to determine choice or defaulted to docker
if (!choice || typeof choice !== 'string') {
return;
// Unable to determine choice or when defaulted to docker
// When testing we want to test if we defaulted correctly in some cases
// So in this case just return the defaulted command when testing
if (
!choice ||
typeof choice !== 'string' ||
(process.env.NODE_ENV === 'test' &&
choice.startsWith(`docker ${this.command}`))
) {
return choice;
}

this.id = choice.split('-')[0].trim();
Expand Down

0 comments on commit f12c447

Please sign in to comment.