command.commandHelp.test.js
This file
Path
tests/command.commandHelp.test.js
19 lines · 663 bytes · JavaScript
Last changed by
Move to Jest as testing framework (#1035)John Geebefore adoptiond7f9cd4
History of this fileTake it
1234567891011121314151617181920const commander = require('../');
// Note: .commandHelp is not currently documented in the README. This is a ported legacy test.
test('when program has command then appears in commandHelp', () => { const program = new commander.Command(); program .command('bare'); const commandHelp = program.commandHelp(); expect(commandHelp).toBe('Commands:\n bare\n');});
test('when program has command with optional arg then appears in commandHelp', () => { const program = new commander.Command(); program .command('bare [bare-arg]'); const commandHelp = program.commandHelp(); expect(commandHelp).toEqual('Commands:\n bare [bare-arg]\n');});