Skip to content

Commit

Permalink
refactor: Migrate to unambiguous promptSelectOne()
Browse files Browse the repository at this point in the history
  • Loading branch information
evocateur committed Dec 10, 2020
1 parent e9237f3 commit 5d05d95
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions commands/version/__tests__/prompt-version.test.js
Expand Up @@ -17,7 +17,7 @@ describe("select", () => {
version: "1.2.3",
});

expect(prompt.select).toHaveBeenLastCalledWith(
expect(prompt.promptSelectOne).toHaveBeenLastCalledWith(
"Select a new version (currently 1.2.3)",
expect.objectContaining({
choices: expect.any(Array),
Expand All @@ -31,7 +31,7 @@ describe("select", () => {
name: "my-package",
});

expect(prompt.select).toHaveBeenLastCalledWith(
expect(prompt.promptSelectOne).toHaveBeenLastCalledWith(
"Select a new version for my-package (currently 3.2.1)",
expect.any(Object)
);
Expand Down
4 changes: 2 additions & 2 deletions commands/version/__tests__/version-bump.test.js
Expand Up @@ -23,7 +23,7 @@ describe("version bump", () => {
const testDir = await initFixture("normal");
await lernaVersion(testDir)("1.0.1-beta.25");

expect(PromptUtilities.select).not.toHaveBeenCalled();
expect(PromptUtilities.promptSelectOne).not.toHaveBeenCalled();

const message = await getCommitMessage(testDir);
expect(message).toBe("v1.0.1-beta.25");
Expand Down Expand Up @@ -56,7 +56,7 @@ describe("version bump", () => {
const testDir = await initFixture("normal");
await lernaVersion(testDir)("minor");

expect(PromptUtilities.select).not.toHaveBeenCalled();
expect(PromptUtilities.promptSelectOne).not.toHaveBeenCalled();

const message = await getCommitMessage(testDir);
expect(message).toBe("v1.1.0");
Expand Down
6 changes: 3 additions & 3 deletions commands/version/__tests__/version-command.test.js
Expand Up @@ -56,7 +56,7 @@ describe("VersionCommand", () => {

expect(checkWorkingTree).toHaveBeenCalled();

expect(PromptUtilities.select.mock.calls).toMatchSnapshot("prompt");
expect(PromptUtilities.promptSelectOne.mock.calls).toMatchSnapshot("prompt");
expect(PromptUtilities.confirm).toHaveBeenLastCalledWith(
"Are you sure you want to create these versions?"
);
Expand Down Expand Up @@ -454,7 +454,7 @@ describe("VersionCommand", () => {
const testDir = await initFixture("normal");
await lernaVersion(testDir)("--yes", "patch");

expect(PromptUtilities.select).not.toHaveBeenCalled();
expect(PromptUtilities.promptSelectOne).not.toHaveBeenCalled();
expect(PromptUtilities.confirm).not.toHaveBeenCalled();

const message = await getCommitMessage(testDir);
Expand Down Expand Up @@ -748,7 +748,7 @@ describe("VersionCommand", () => {
const testDir = await initFixture("normal");
await lernaVersion(testDir)("--include-merged-tags", "--yes", "patch");

expect(PromptUtilities.select).not.toHaveBeenCalled();
expect(PromptUtilities.promptSelectOne).not.toHaveBeenCalled();
expect(PromptUtilities.confirm).not.toHaveBeenCalled();

const message = await getCommitMessage(testDir);
Expand Down
2 changes: 1 addition & 1 deletion commands/version/lib/prompt-version.js
Expand Up @@ -31,7 +31,7 @@ function promptVersion(currentVersion, name, prereleaseId) {

const message = `Select a new version ${name ? `for ${name} ` : ""}(currently ${currentVersion})`;

return PromptUtilities.select(message, {
return PromptUtilities.promptSelectOne(message, {
choices: [
{ value: patch, name: `Patch (${patch})` },
{ value: minor, name: `Minor (${minor})` },
Expand Down

0 comments on commit 5d05d95

Please sign in to comment.