Skip to content

Commit

Permalink
fix(decision-values): accepted false as a valid decision
Browse files Browse the repository at this point in the history
w/o losing it to falsy logic
  • Loading branch information
travi committed Jan 15, 2020
1 parent 08184cc commit 8979238
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/prompt-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ suite('prompt', () => {
});

test('that decisions are directly included in answers, with those questions excluded from prompts', async () => {
const decisions = any.simpleObject();
const questionNames = Object.keys(decisions);
const questionNames = any.listOf(any.word);
const decisions = any.objectWithKeys(questionNames, {factory: any.boolean});
inquirer.prompt.withArgs(questions).resolves(answers);

assert.deepEqual(
Expand Down
2 changes: 1 addition & 1 deletion src/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {prompt} from 'inquirer';

export default async function (questions, decisions = {}) {
const {filteredQuestions, providedAnswers} = questions.reduce((acc, question) => {
if (decisions[question.name]) {
if (undefined !== decisions[question.name]) {
return {
filteredQuestions: acc.filteredQuestions,
providedAnswers: {...acc.providedAnswers, [question.name]: decisions[question.name]}
Expand Down

0 comments on commit 8979238

Please sign in to comment.