Skip to content

Commit 59a7e98

Browse files
TomMcGrath7cameroncooke
authored andcommitted
Update next-steps-renderer.test.ts
1 parent b8b6141 commit 59a7e98

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

src/utils/responses/__tests__/next-steps-renderer.test.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -60,30 +60,6 @@ describe('next-steps-renderer', () => {
6060
expect(renderNextStep(step, 'cli')).toBe('Open the Simulator app: xcodebuildmcp open-sim');
6161
});
6262

63-
it('should not throw when cliTool is absent and tool name contains underscores (regression for #226)', () => {
64-
// In v2.0.7, snapshot_ui next steps referenced 'tap_coordinate' and 'take_screenshot',
65-
// which had no catalog entries, so enrichNextStepsForCli left cliTool undefined.
66-
// The renderer then threw: "Next step for tool 'tap_coordinate' is missing cliTool".
67-
// The fix: fall back to toKebabCase(tool) instead of throwing.
68-
const steps: NextStep[] = [
69-
{
70-
tool: 'tap_coordinate',
71-
label: 'Tap on element',
72-
params: { simulatorId: 'ABC', x: 0, y: 0 },
73-
},
74-
{
75-
tool: 'take_screenshot',
76-
label: 'Take screenshot for verification',
77-
params: { simulatorId: 'ABC' },
78-
},
79-
];
80-
81-
expect(() => renderNextStepsSection(steps, 'cli')).not.toThrow();
82-
const result = renderNextStepsSection(steps, 'cli');
83-
expect(result).toContain('xcodebuildmcp tap-coordinate');
84-
expect(result).toContain('xcodebuildmcp take-screenshot');
85-
});
86-
8763
it('should format step for CLI without workflow', () => {
8864
const step: NextStep = {
8965
tool: 'open_sim',
@@ -247,6 +223,30 @@ describe('next-steps-renderer', () => {
247223
expect(result).toContain('1. Take a look at the screenshot');
248224
expect(result).toContain('2. Open simulator: xcodebuildmcp open-sim');
249225
});
226+
227+
it('should not throw when cliTool is absent and tool name contains underscores (regression for #226)', () => {
228+
// In v2.0.7, snapshot_ui next steps referenced 'tap_coordinate' and 'take_screenshot',
229+
// which had no catalog entries, so enrichNextStepsForCli left cliTool undefined.
230+
// The renderer then threw: "Next step for tool 'tap_coordinate' is missing cliTool".
231+
// The fix: fall back to toKebabCase(tool) instead of throwing.
232+
const steps: NextStep[] = [
233+
{
234+
tool: 'tap_coordinate',
235+
label: 'Tap on element',
236+
params: { simulatorId: 'ABC', x: 0, y: 0 },
237+
},
238+
{
239+
tool: 'take_screenshot',
240+
label: 'Take screenshot for verification',
241+
params: { simulatorId: 'ABC' },
242+
},
243+
];
244+
245+
expect(() => renderNextStepsSection(steps, 'cli')).not.toThrow();
246+
const result = renderNextStepsSection(steps, 'cli');
247+
expect(result).toContain('xcodebuildmcp tap-coordinate');
248+
expect(result).toContain('xcodebuildmcp take-screenshot');
249+
});
250250
});
251251

252252
describe('processToolResponse', () => {

0 commit comments

Comments
 (0)