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
1234567891011121314151617181920212223242526272829303132333435const commander = require('../');
// These are tests of the Help class, not of the Command help.// There is some overlap with the higher level Command tests (which predate Help).
describe('optionTerm', () => { test('when -s flags then returns flags', () => { const flags = '-s'; const option = new commander.Option(flags); const helper = new commander.Help(); expect(helper.optionTerm(option)).toEqual(flags); });
test('when --short flags then returns flags', () => { const flags = '--short'; const option = new commander.Option(flags); const helper = new commander.Help(); expect(helper.optionTerm(option)).toEqual(flags); });
test('when -s,--short flags then returns flags', () => { const flags = '-s,--short'; const option = new commander.Option(flags); const helper = new commander.Help(); expect(helper.optionTerm(option)).toEqual(flags); });
test('when -s|--short flags then returns flags', () => { const flags = '-s|--short'; const option = new commander.Option(flags); const helper = new commander.Help(); expect(helper.optionTerm(option)).toEqual(flags); });});