Skip to content

Commit e5d8ca2

Browse files
committed
test(device): cover non-iOS platform build_device path
Adds a watchOS test verifying that the build command targets generic/platform=watchOS, the log prefix reflects the platform, and get_device_app_path next-step params include the resolved platform.
1 parent fb7e18d commit e5d8ca2

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

src/mcp/tools/device/__tests__/build_device.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,5 +346,32 @@ describe('build_device plugin', () => {
346346
]);
347347
expect(spy.commandCalls[0].logPrefix).toBe('iOS Device Build');
348348
});
349+
350+
it('should target watchOS platform when platform=watchOS is provided', async () => {
351+
const spy = createSpyExecutor();
352+
353+
const { result } = await runToolLogic(() =>
354+
buildDeviceLogic(
355+
{
356+
projectPath: '/path/to/MyWatchApp.xcodeproj',
357+
scheme: 'MyWatchApp',
358+
platform: 'watchOS',
359+
},
360+
spy.executor,
361+
),
362+
);
363+
364+
expect(spy.commandCalls).toHaveLength(1);
365+
const args = spy.commandCalls[0].args;
366+
const destinationIndex = args.indexOf('-destination');
367+
expect(destinationIndex).toBeGreaterThan(-1);
368+
expect(args[destinationIndex + 1]).toBe('generic/platform=watchOS');
369+
expect(spy.commandCalls[0].logPrefix).toBe('watchOS Device Build');
370+
expect(result.nextStepParams).toEqual(
371+
expect.objectContaining({
372+
get_device_app_path: expect.objectContaining({ platform: 'watchOS' }),
373+
}),
374+
);
375+
});
349376
});
350377
});

0 commit comments

Comments
 (0)