From a1a40281c0f2259c92e0aededc813597b2a98a29 Mon Sep 17 00:00:00 2001 From: Tom McGrath <81921465+TomMcGrath7@users.noreply.github.com> Date: Wed, 18 Feb 2026 14:09:38 +0100 Subject: [PATCH 1/2] Update next-steps-renderer.test.ts --- .../__tests__/next-steps-renderer.test.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/utils/responses/__tests__/next-steps-renderer.test.ts b/src/utils/responses/__tests__/next-steps-renderer.test.ts index c0ff6080..872ac683 100644 --- a/src/utils/responses/__tests__/next-steps-renderer.test.ts +++ b/src/utils/responses/__tests__/next-steps-renderer.test.ts @@ -60,6 +60,30 @@ describe('next-steps-renderer', () => { expect(renderNextStep(step, 'cli')).toBe('Open the Simulator app: xcodebuildmcp open-sim'); }); + it('should not throw when cliTool is absent and tool name contains underscores (regression for #226)', () => { + // In v2.0.7, snapshot_ui next steps referenced 'tap_coordinate' and 'take_screenshot', + // which had no catalog entries, so enrichNextStepsForCli left cliTool undefined. + // The renderer then threw: "Next step for tool 'tap_coordinate' is missing cliTool". + // The fix: fall back to toKebabCase(tool) instead of throwing. + const steps: NextStep[] = [ + { + tool: 'tap_coordinate', + label: 'Tap on element', + params: { simulatorId: 'ABC', x: 0, y: 0 }, + }, + { + tool: 'take_screenshot', + label: 'Take screenshot for verification', + params: { simulatorId: 'ABC' }, + }, + ]; + + expect(() => renderNextStepsSection(steps, 'cli')).not.toThrow(); + const result = renderNextStepsSection(steps, 'cli'); + expect(result).toContain('xcodebuildmcp tap-coordinate'); + expect(result).toContain('xcodebuildmcp take-screenshot'); + }); + it('should format step for CLI without workflow', () => { const step: NextStep = { tool: 'open_sim', From 3bcf38a939e863085a23efdc67840a2251261582 Mon Sep 17 00:00:00 2001 From: Tom McGrath <81921465+TomMcGrath7@users.noreply.github.com> Date: Wed, 18 Feb 2026 14:18:58 +0100 Subject: [PATCH 2/2] Update next-steps-renderer.test.ts --- .../__tests__/next-steps-renderer.test.ts | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/utils/responses/__tests__/next-steps-renderer.test.ts b/src/utils/responses/__tests__/next-steps-renderer.test.ts index 872ac683..acac43d8 100644 --- a/src/utils/responses/__tests__/next-steps-renderer.test.ts +++ b/src/utils/responses/__tests__/next-steps-renderer.test.ts @@ -60,30 +60,6 @@ describe('next-steps-renderer', () => { expect(renderNextStep(step, 'cli')).toBe('Open the Simulator app: xcodebuildmcp open-sim'); }); - it('should not throw when cliTool is absent and tool name contains underscores (regression for #226)', () => { - // In v2.0.7, snapshot_ui next steps referenced 'tap_coordinate' and 'take_screenshot', - // which had no catalog entries, so enrichNextStepsForCli left cliTool undefined. - // The renderer then threw: "Next step for tool 'tap_coordinate' is missing cliTool". - // The fix: fall back to toKebabCase(tool) instead of throwing. - const steps: NextStep[] = [ - { - tool: 'tap_coordinate', - label: 'Tap on element', - params: { simulatorId: 'ABC', x: 0, y: 0 }, - }, - { - tool: 'take_screenshot', - label: 'Take screenshot for verification', - params: { simulatorId: 'ABC' }, - }, - ]; - - expect(() => renderNextStepsSection(steps, 'cli')).not.toThrow(); - const result = renderNextStepsSection(steps, 'cli'); - expect(result).toContain('xcodebuildmcp tap-coordinate'); - expect(result).toContain('xcodebuildmcp take-screenshot'); - }); - it('should format step for CLI without workflow', () => { const step: NextStep = { tool: 'open_sim', @@ -247,6 +223,30 @@ describe('next-steps-renderer', () => { expect(result).toContain('1. Take a look at the screenshot'); expect(result).toContain('2. Open simulator: xcodebuildmcp open-sim'); }); + + it('should not throw when cliTool is absent and tool name contains underscores (regression for #226)', () => { + // In v2.0.7, snapshot_ui next steps referenced 'tap_coordinate' and 'take_screenshot', + // which had no catalog entries, so enrichNextStepsForCli left cliTool undefined. + // The renderer then threw: "Next step for tool 'tap_coordinate' is missing cliTool". + // The fix: fall back to toKebabCase(tool) instead of throwing. + const steps: NextStep[] = [ + { + tool: 'tap_coordinate', + label: 'Tap on element', + params: { simulatorId: 'ABC', x: 0, y: 0 }, + }, + { + tool: 'take_screenshot', + label: 'Take screenshot for verification', + params: { simulatorId: 'ABC' }, + }, + ]; + + expect(() => renderNextStepsSection(steps, 'cli')).not.toThrow(); + const result = renderNextStepsSection(steps, 'cli'); + expect(result).toContain('xcodebuildmcp tap-coordinate'); + expect(result).toContain('xcodebuildmcp take-screenshot'); + }); }); describe('processToolResponse', () => {