test(dacli): strengthen installHelpHook test with outputHelp capture
This commit is contained in:
1 parent
3f7498b496
commit
cc64e13d86
1 file changed
+21
@@ -100,4 +100,25 @@ describe('installHelpHook', () => {
|
||||
const helpOutput = cmd.helpInformation()
|
||||
expect(helpOutput).toContain('test purpose')
|
||||
})
|
||||
|
||||
it('should inject sections via addHelpText into actual --help output', () => {
|
||||
const cmd = new Command('test')
|
||||
installHelpHook(cmd, {
|
||||
purpose: 'test purpose',
|
||||
example: 'dacli foo --bar',
|
||||
bestPractices: ['use --autoRelease'],
|
||||
})
|
||||
|
||||
// Capture the full output via configureOutput
|
||||
let captured = ''
|
||||
cmd.configureOutput({ writeOut: (s) => { captured += s } })
|
||||
cmd.outputHelp()
|
||||
|
||||
// Sections must appear in actual --help output (NOT helpInformation)
|
||||
expect(captured).toContain('test purpose') // from .description()
|
||||
expect(captured).toContain('Examples:')
|
||||
expect(captured).toContain('dacli foo --bar')
|
||||
expect(captured).toContain('Best Practices:')
|
||||
expect(captured).toContain('use --autoRelease')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user