Skip to content
Permalink
Browse files

Using checkbox to open more than one article at a time

  • Loading branch information...
kpman committed Dec 17, 2017
1 parent 3a6a608 commit 90a279c191a20746be3165ec2c7aefbb5374ecaa
@@ -24,7 +24,7 @@ beforeEach(() => {
inquirer = require('inquirer');
inquirer.prompt.mockReturnValue(
Promise.resolve({
title: 'NBA-GO',
title: ['NBA-GO'],
})
);
thenify = require('thenify');
@@ -87,7 +87,7 @@ describe('#readNews', () => {
'newsroom',
]);
expect(inquirer.prompt.mock.calls[0][0][0].pageSize).toBe(10);
expect(inquirer.prompt.mock.calls[0][0][0].type).toBe('list');
expect(inquirer.prompt.mock.calls[0][0][0].type).toBe('checkbox');
});

it('should call open', async () => {
@@ -8,7 +8,7 @@ describe('#getTitleQuestion', () => {
it('should return a list type question', () => {
const titles = [];
const q = getTitleQuestion(titles);
expect(q.type).toBe('list');
expect(q.type).toBe('checkbox');
});

it('should return a question object with name `title`', () => {
@@ -1,5 +1,5 @@
module.exports = (titles, pageSize = 5) => ({
type: 'list',
type: 'checkbox',
name: 'title',
message: 'Please choose which title you want to open',
choices: titles,
@@ -71,7 +71,7 @@ module.exports = async (source, sources, pageSize = 10) => {
]);
}

const url = articleMap[titleAnswer.title];

open(url);
titleAnswer.title.forEach(t => {
open(articleMap[t]);
});
};

0 comments on commit 90a279c

Please sign in to comment.
You can’t perform that action at this time.