From a0c1a773b66b6ec4d4e8b6641c2cabf5e8aa86aa Mon Sep 17 00:00:00 2001 From: John Gee Date: Tue, 2 Feb 2021 22:02:34 +1300 Subject: [PATCH] Test for help for arguments without description (#1459) --- tests/command.help.test.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/command.help.test.js b/tests/command.help.test.js index 069f00d20..43e0fb01b 100644 --- a/tests/command.help.test.js +++ b/tests/command.help.test.js @@ -251,5 +251,15 @@ test('when arguments described then included in helpInformation', () => { .helpOption(false) .description('description', { file: 'input source' }); const helpInformation = program.helpInformation(); - expect(helpInformation).toMatch(/Arguments:\n +file +input source/); // [sic], extra line + expect(helpInformation).toMatch(/Arguments:\n +file +input source/); +}); + +test('when arguments described and empty description then arguments included in helpInformation', () => { + const program = new commander.Command(); + program + .arguments('') + .helpOption(false) + .description('', { file: 'input source' }); + const helpInformation = program.helpInformation(); + expect(helpInformation).toMatch(/Arguments:\n +file +input source/); });