Skip to content

Commit fb25bd2

Browse files
committedMay 29, 2019
tests(inputvalidate): remove undefined
1 parent 376dcbd commit fb25bd2

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed
 

‎packages/webpack-scaffold/__tests__/__snapshots__/index.test.ts.snap

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
exports[`utils Inquirer should make an Input object with validation 1`] = `
44
Object {
5-
"default": undefined,
65
"message": "what is your plugin?",
76
"name": "plugins",
87
"type": "input",

‎packages/webpack-scaffold/__tests__/index.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ describe("utils", () => {
7676
});
7777
it("should make an Input object", () => {
7878
expect(utils.Input("plugins", "what is your plugin?")).toEqual({
79-
default: undefined,
8079
message: "what is your plugin?",
8180
name: "plugins",
8281
type: "input",

‎packages/webpack-scaffold/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,14 @@ export function InputValidate(
9292
defaultChoice?: string,
9393
): Generator.Question {
9494

95-
return {
96-
default: defaultChoice,
95+
const input: Generator.Question = {
9796
message,
9897
name,
9998
type: "input",
10099
validate: cb
101100
};
101+
if (defaultChoice !== undefined) input.default = defaultChoice;
102+
return input;
102103
}
103104

104105
export function Confirm(name: string, message: string, defaultChoice: boolean = true): Generator.Question {

0 commit comments

Comments
 (0)
Please sign in to comment.