help.optionTerm.test.js
This file
Path
tests/help.optionTerm.test.js
34 lines · 1.1 KiB · JavaScript
Last changed by
Refactor help internals into separate interface/class (#1365)John Geebefore adoption19ae912
History of this fileTake it
Refactor help internals into separate interface/class (#1365)John Geebefore adoption19ae912
lines 1–34why, one step back1const commander = require('../');23// These are tests of the Help class, not of the Command help.4// There is some overlap with the higher level Command tests (which predate Help).56describe('optionTerm', () => {7 test('when -s flags then returns flags', () => {8 const flags = '-s';9 const option = new commander.Option(flags);10 const helper = new commander.Help();11 expect(helper.optionTerm(option)).toEqual(flags);12 });1314 test('when --short flags then returns flags', () => {15 const flags = '--short';16 const option = new commander.Option(flags);17 const helper = new commander.Help();18 expect(helper.optionTerm(option)).toEqual(flags);19 });2021 test('when -s,--short flags then returns flags', () => {22 const flags = '-s,--short';23 const option = new commander.Option(flags);24 const helper = new commander.Help();25 expect(helper.optionTerm(option)).toEqual(flags);26 });2728 test('when -s|--short flags then returns flags', () => {29 const flags = '-s|--short';30 const option = new commander.Option(flags);31 const helper = new commander.Help();32 expect(helper.optionTerm(option)).toEqual(flags);33 });34});