Skip to content

Commit

Permalink
fix(hosts-prompt): list host names as choices rather than full plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
travi committed Aug 3, 2024
1 parent 7ad591a commit 5b23dd8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/vcs/host/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default async function (hosts, visibility, decisions) {
name: questionNames.REPO_HOST,
type: 'list',
message: 'Where will the repository be hosted?',
choices: hosts
choices: Object.keys(hosts)
}], decisions);
const host = hosts[answers[questionNames.REPO_HOST]];

Expand Down
7 changes: 3 additions & 4 deletions src/vcs/host/prompt.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,22 @@ describe('vcs host details prompt', () => {
name: questionNames.REPO_HOST,
type: 'list',
message: 'Where will the repository be hosted?',
choices: hosts
choices: hostNames
}], decisions).mockResolvedValue(answersWithHostChoice);

expect(await promptForVcsHostDetails(hosts, null, decisions)).toEqual(answersWithHostChoice);
});

it('should not throw an error when `Other` is chosen as the host', async () => {
const hosts = {};
const visibility = any.word();
const answersWithHostChoice = {...answers, [questionNames.REPO_HOST]: 'Other'};
when(prompts.prompt).calledWith([{
name: questionNames.REPO_HOST,
type: 'list',
message: 'Where will the repository be hosted?',
choices: hosts
choices: []
}], decisions).mockResolvedValue(answersWithHostChoice);

expect(await promptForVcsHostDetails(hosts, visibility, decisions)).toEqual(answersWithHostChoice);
expect(await promptForVcsHostDetails({}, visibility, decisions)).toEqual(answersWithHostChoice);
});
});

0 comments on commit 5b23dd8

Please sign in to comment.