Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/utils/responses/__tests__/next-steps-renderer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,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', () => {
Expand Down