Skip to content

Commit

Permalink
refactor(test): Use unambiguous mockPromptChoices() method
Browse files Browse the repository at this point in the history
  • Loading branch information
evocateur committed Dec 10, 2020
1 parent 3c67f15 commit a08bafb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions commands/version/__tests__/prompt-version.test.js
Expand Up @@ -47,7 +47,7 @@ describe("select", () => {
["preminor", "1.1.0-alpha.0"],
["premajor", "2.0.0-alpha.0"],
])("bump %s", async (bump, result) => {
prompt.mockChoices(bump);
prompt.mockPromptChoices(bump);

const choice = await versionPrompt({
version: "1.0.0",
Expand All @@ -64,7 +64,7 @@ describe("custom version", () => {
let inputValidate;

beforeEach(() => {
prompt.mockChoices("CUSTOM");
prompt.mockPromptChoices("CUSTOM");

prompt.promptTextInput.mockImplementationOnce((msg, cfg) => {
inputFilter = cfg.filter;
Expand Down Expand Up @@ -102,7 +102,7 @@ describe("custom prerelease", () => {
let inputFilter;

beforeEach(() => {
prompt.mockChoices("PRERELEASE");
prompt.mockPromptChoices("PRERELEASE");

prompt.promptTextInput.mockImplementationOnce((msg, cfg) => {
inputFilter = cfg.filter;
Expand Down
2 changes: 1 addition & 1 deletion commands/version/__tests__/version-bump-prerelease.test.js
Expand Up @@ -152,7 +152,7 @@ test("independent version prerelease does not bump on every unrelated change", a
await gitCommit(cwd, "init");

// simulate choices for pkg-a then pkg-b
prompt.mockChoices("patch", "PRERELEASE");
prompt.mockPromptChoices("patch", "PRERELEASE");
prompt.promptTextInput.mockImplementationOnce((msg, cfg) =>
// the _existing_ "bumps" prerelease ID should be preserved
Promise.resolve(cfg.filter())
Expand Down
8 changes: 4 additions & 4 deletions commands/version/__tests__/version-command.test.js
Expand Up @@ -137,7 +137,7 @@ describe("VersionCommand", () => {
const testDir = await initFixture("normal");

collectUpdates.setUpdated(testDir, "package-3");
PromptUtilities.mockChoices("minor");
PromptUtilities.mockPromptChoices("minor");

await lernaVersion(testDir)();

Expand All @@ -149,7 +149,7 @@ describe("VersionCommand", () => {
const testDir = await initFixture("normal");

collectUpdates.setUpdated(testDir, "package-3");
PromptUtilities.mockChoices("major");
PromptUtilities.mockPromptChoices("major");

await lernaVersion(testDir)();

Expand All @@ -162,7 +162,7 @@ describe("VersionCommand", () => {

// despite being a pendant leaf...
collectUpdates.setUpdated(testDir, "package-4");
PromptUtilities.mockChoices("major");
PromptUtilities.mockPromptChoices("major");

await lernaVersion(testDir)("--no-private");

Expand All @@ -176,7 +176,7 @@ describe("VersionCommand", () => {
describe("independent mode", () => {
it("versions changed packages", async () => {
// mock version prompt choices
PromptUtilities.mockChoices("patch", "minor", "major", "minor", "patch");
PromptUtilities.mockPromptChoices("patch", "minor", "major", "minor", "patch");

const testDir = await initFixture("independent");
await lernaVersion(testDir)(); // --independent is only valid in InitCommand
Expand Down

0 comments on commit a08bafb

Please sign in to comment.