11/**
2- * Tests for build_run_simulator_name plugin (unified)
2+ * Tests for build_run_simulator plugin (unified)
33 * Following CLAUDE.md testing standards with dependency injection and literal validation
44 */
55
66import { describe , it , expect , beforeEach } from 'vitest' ;
77import { z } from 'zod' ;
88import { createMockExecutor , createMockFileSystemExecutor } from '../../../../utils/command.js' ;
9- import buildRunSimulatorName , {
10- build_run_simulator_nameLogic ,
11- } from '../build_run_simulator_name.js' ;
9+ import buildRunSimulator , { build_run_simulatorLogic } from '../build_run_simulator.js' ;
1210
13- describe ( 'build_run_simulator_name tool' , ( ) => {
11+ describe ( 'build_run_simulator tool' , ( ) => {
1412 describe ( 'Export Field Validation (Literal)' , ( ) => {
1513 it ( 'should have correct name' , ( ) => {
16- expect ( buildRunSimulatorName . name ) . toBe ( 'build_run_simulator_name ' ) ;
14+ expect ( buildRunSimulator . name ) . toBe ( 'build_run_simulator ' ) ;
1715 } ) ;
1816
1917 it ( 'should have correct description' , ( ) => {
20- expect ( buildRunSimulatorName . description ) . toBe (
21- "Builds and runs an app from a project or workspace on a specific simulator by name. Provide exactly one of projectPath or workspacePath. IMPORTANT: Requires either projectPath or workspacePath, plus scheme and simulatorName. Example: build_run_simulator_name ({ projectPath: '/path/to/MyProject.xcodeproj', scheme: 'MyScheme', simulatorName: 'iPhone 16' })" ,
18+ expect ( buildRunSimulator . description ) . toBe (
19+ "Builds and runs an app from a project or workspace on a specific simulator by UUID or name. Provide exactly one of projectPath or workspacePath, and exactly one of simulatorId or simulatorName . IMPORTANT: Requires either projectPath or workspacePath, plus scheme and either simulatorId or simulatorName. Example: build_run_simulator ({ projectPath: '/path/to/MyProject.xcodeproj', scheme: 'MyScheme', simulatorName: 'iPhone 16' })" ,
2220 ) ;
2321 } ) ;
2422
2523 it ( 'should have handler function' , ( ) => {
26- expect ( typeof buildRunSimulatorName . handler ) . toBe ( 'function' ) ;
24+ expect ( typeof buildRunSimulator . handler ) . toBe ( 'function' ) ;
2725 } ) ;
2826
2927 it ( 'should have correct schema with required and optional fields' , ( ) => {
30- const schema = z . object ( buildRunSimulatorName . schema ) ;
28+ const schema = z . object ( buildRunSimulator . schema ) ;
3129
3230 // Valid inputs - workspace
3331 expect (
@@ -61,12 +59,13 @@ describe('build_run_simulator_name tool', () => {
6159 ) . toBe ( true ) ;
6260
6361 // Invalid inputs - missing required fields
62+ // Note: simulatorId/simulatorName are optional at schema level, XOR validation at runtime
6463 expect (
6564 schema . safeParse ( {
6665 workspacePath : '/path/to/workspace' ,
6766 scheme : 'MyScheme' ,
6867 } ) . success ,
69- ) . toBe ( false ) ;
68+ ) . toBe ( true ) ; // Schema validation passes, runtime XOR validation would catch missing simulator fields
7069
7170 expect (
7271 schema . safeParse ( {
@@ -139,7 +138,7 @@ describe('build_run_simulator_name tool', () => {
139138 } ;
140139 } ;
141140
142- const result = await build_run_simulator_nameLogic (
141+ const result = await build_run_simulatorLogic (
143142 {
144143 workspacePath : '/path/to/workspace' ,
145144 scheme : 'MyScheme' ,
@@ -165,7 +164,7 @@ describe('build_run_simulator_name tool', () => {
165164 error : 'Build failed with error' ,
166165 } ) ;
167166
168- const result = await build_run_simulator_nameLogic (
167+ const result = await build_run_simulatorLogic (
169168 {
170169 workspacePath : '/path/to/workspace' ,
171170 scheme : 'MyScheme' ,
@@ -238,7 +237,7 @@ describe('build_run_simulator_name tool', () => {
238237 }
239238 } ;
240239
241- const result = await build_run_simulator_nameLogic (
240+ const result = await build_run_simulatorLogic (
242241 {
243242 workspacePath : '/path/to/workspace' ,
244243 scheme : 'MyScheme' ,
@@ -258,7 +257,7 @@ describe('build_run_simulator_name tool', () => {
258257 error : 'Command failed' ,
259258 } ) ;
260259
261- const result = await build_run_simulator_nameLogic (
260+ const result = await build_run_simulatorLogic (
262261 {
263262 workspacePath : '/path/to/workspace' ,
264263 scheme : 'MyScheme' ,
@@ -278,7 +277,7 @@ describe('build_run_simulator_name tool', () => {
278277 error : 'String error' ,
279278 } ) ;
280279
281- const result = await build_run_simulator_nameLogic (
280+ const result = await build_run_simulatorLogic (
282281 {
283282 workspacePath : '/path/to/workspace' ,
284283 scheme : 'MyScheme' ,
@@ -318,7 +317,7 @@ describe('build_run_simulator_name tool', () => {
318317 } ;
319318 } ;
320319
321- const result = await build_run_simulator_nameLogic (
320+ const result = await build_run_simulatorLogic (
322321 {
323322 workspacePath : '/path/to/MyProject.xcworkspace' ,
324323 scheme : 'MyScheme' ,
@@ -393,7 +392,7 @@ describe('build_run_simulator_name tool', () => {
393392 }
394393 } ;
395394
396- const result = await build_run_simulator_nameLogic (
395+ const result = await build_run_simulatorLogic (
397396 {
398397 workspacePath : '/path/to/MyProject.xcworkspace' ,
399398 scheme : 'MyScheme' ,
@@ -493,7 +492,7 @@ describe('build_run_simulator_name tool', () => {
493492 }
494493 } ;
495494
496- const result = await build_run_simulator_nameLogic (
495+ const result = await build_run_simulatorLogic (
497496 {
498497 workspacePath : '/path/to/MyProject.xcworkspace' ,
499498 scheme : 'MyScheme' ,
@@ -563,7 +562,7 @@ describe('build_run_simulator_name tool', () => {
563562 } ;
564563 } ;
565564
566- const result = await build_run_simulator_nameLogic (
565+ const result = await build_run_simulatorLogic (
567566 {
568567 workspacePath : '/Users/dev/My Project/MyProject.xcworkspace' ,
569568 scheme : 'My Scheme' ,
@@ -593,7 +592,7 @@ describe('build_run_simulator_name tool', () => {
593592
594593 describe ( 'XOR Validation' , ( ) => {
595594 it ( 'should error when neither projectPath nor workspacePath provided' , async ( ) => {
596- const result = await buildRunSimulatorName . handler ( {
595+ const result = await buildRunSimulator . handler ( {
597596 scheme : 'MyScheme' ,
598597 simulatorName : 'iPhone 16' ,
599598 } ) ;
@@ -602,7 +601,7 @@ describe('build_run_simulator_name tool', () => {
602601 } ) ;
603602
604603 it ( 'should error when both projectPath and workspacePath provided' , async ( ) => {
605- const result = await buildRunSimulatorName . handler ( {
604+ const result = await buildRunSimulator . handler ( {
606605 projectPath : '/path/project.xcodeproj' ,
607606 workspacePath : '/path/workspace.xcworkspace' ,
608607 scheme : 'MyScheme' ,
@@ -619,7 +618,7 @@ describe('build_run_simulator_name tool', () => {
619618 error : 'Build failed' ,
620619 } ) ;
621620
622- const result = await build_run_simulator_nameLogic (
621+ const result = await build_run_simulatorLogic (
623622 {
624623 projectPath : '/path/project.xcodeproj' ,
625624 scheme : 'MyScheme' ,
@@ -639,7 +638,7 @@ describe('build_run_simulator_name tool', () => {
639638 error : 'Build failed' ,
640639 } ) ;
641640
642- const result = await build_run_simulator_nameLogic (
641+ const result = await build_run_simulatorLogic (
643642 {
644643 workspacePath : '/path/workspace.xcworkspace' ,
645644 scheme : 'MyScheme' ,
0 commit comments