diff --git a/tests/core/help.spec.ts b/tests/core/help.spec.ts index a86eaef..152a071 100644 --- a/tests/core/help.spec.ts +++ b/tests/core/help.spec.ts @@ -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') + }) })