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
Move to Jest as testing framework (#1035)John Geebefore adoptiond7f9cd4
lines 1–19why, one step back1const commander = require('../');23// Note: .commandHelp is not currently documented in the README. This is a ported legacy test.45test('when program has command then appears in commandHelp', () => {6 const program = new commander.Command();7 program8 .command('bare');9 const commandHelp = program.commandHelp();10 expect(commandHelp).toBe('Commands:\n bare\n');11});1213test('when program has command with optional arg then appears in commandHelp', () => {14 const program = new commander.Command();15 program16 .command('bare [bare-arg]');17 const commandHelp = program.commandHelp();18 expect(commandHelp).toEqual('Commands:\n bare [bare-arg]\n');19});