command.nested.test.js
This file
Path
tests/command.nested.test.js
12 lines · 340 bytes · JavaScript
Last changed by
Not known.
History of this fileTake it
12345678910111213const commander = require('../');
test('when call nested subcommand then runs', () => { const program = new commander.Command(); const leafAction = jest.fn(); program .command('sub1') .command('sub2') .action(leafAction); program.parse('node test.js sub1 sub2'.split(' ')); expect(leafAction).toHaveBeenCalled();});