Skip to content

Commit

Permalink
Add test for addTextHelp returning void (#1351)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspawn authored Sep 9, 2020
1 parent d26a26d commit 8afc0ba
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/command.addHelp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ describe('program calls to addHelpText', () => {
expect(writeSpy).toHaveBeenNthCalledWith(2, program.helpInformation());
});

test('when "before" function returns void then no effect', () => {
const program = new commander.Command();
program.addHelpText('before', () => { });
program.outputHelp();
expect(writeSpy).toHaveBeenNthCalledWith(1, program.helpInformation());
});

test('when "beforeAll" string then string before built-in help', () => {
const program = new commander.Command();
program.addHelpText('beforeAll', 'text');
Expand Down

0 comments on commit 8afc0ba

Please sign in to comment.