Skip to content

Commit

Permalink
chore: increase coverage for webpack-scaffold (#1452)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 authored Apr 15, 2020
1 parent d268e13 commit 13bf7e5
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/webpack-scaffold/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ describe('utils', () => {
});
});
describe('Inquirer', () => {
it('should emulate a prompt for List', () => {
expect(List(this.mockSelf, 'entry', 'does it work?', ['Yes', 'Maybe'], 'Yes')).toEqual({
choices: ['Yes', 'Maybe'],
type: 'list',
name: 'entry',
message: 'does it work?',
default: 'Yes',
});
});

it('should make default value for a List', () => {
expect(List(this.mockSelf, 'entry', 'does it work?', ['Yes', 'Maybe'], 'Yes', true)).toEqual({
entry: 'Yes',
Expand All @@ -87,7 +97,7 @@ describe('utils', () => {
});
});
it('should emulate a prompt for list input', () => {
expect(Input(this.mockSelf, 'plugins', 'what is your plugin?', 'openJSF', false)).toEqual({
expect(Input(this.mockSelf, 'plugins', 'what is your plugin?', 'openJSF')).toEqual({
type: 'input',
name: 'plugins',
message: 'what is your plugin?',
Expand All @@ -100,7 +110,7 @@ describe('utils', () => {
});
});
it('should emulate a prompt for confirm', () => {
expect(Confirm(this.mockSelf, 'context', 'what is your context?', true, false)).toEqual({
expect(Confirm(this.mockSelf, 'context', 'what is your context?')).toEqual({
name: 'context',
default: true,
message: 'what is your context?',
Expand All @@ -118,5 +128,10 @@ describe('utils', () => {
it('should make an Input object with validation and default value', () => {
expect(InputValidate(this.mockSelf, 'plugins', 'what is your plugin?', () => true, 'my-plugin')).toMatchSnapshot();
});
it('should return a default Input object with validation and default value', () => {
expect(InputValidate(this.mockSelf, 'plugins', 'what is your plugin?', () => true, 'my-plugin', true)).toEqual({
plugins: 'my-plugin',
});
});
});
});

0 comments on commit 13bf7e5

Please sign in to comment.