@@ -192,4 +192,40 @@ exit 0`,
192192 expect ( result . ok ) . toBe ( true ) ;
193193 expect ( result . stdout ) . toBe ( "BBBBB22222" ) ;
194194 } ) ;
195+
196+ it ( "matches preferred team IDs even when parser output uses CRLF line endings" , async ( ) => {
197+ const homeDir = await mkdtemp ( path . join ( os . tmpdir ( ) , "openclaw-ios-team-id-" ) ) ;
198+ const binDir = path . join ( homeDir , "bin" ) ;
199+ await mkdir ( binDir , { recursive : true } ) ;
200+ await mkdir ( path . join ( homeDir , "Library" , "Preferences" ) , { recursive : true } ) ;
201+ await writeFile ( path . join ( homeDir , "Library" , "Preferences" , "com.apple.dt.Xcode.plist" ) , "" ) ;
202+
203+ await writeExecutable (
204+ path . join ( binDir , "plutil" ) ,
205+ `#!/usr/bin/env bash
206+ echo '{}'` ,
207+ ) ;
208+ await writeExecutable (
209+ path . join ( binDir , "defaults" ) ,
210+ `#!/usr/bin/env bash
211+ if [[ "$3" == "DVTDeveloperAccountManagerAppleIDLists" ]]; then
212+ echo '(identifier = "[email protected] ";)' 213+ exit 0
214+ fi
215+ exit 0` ,
216+ ) ;
217+ await writeExecutable (
218+ path . join ( binDir , "fake-python" ) ,
219+ `#!/usr/bin/env bash
220+ printf 'AAAAA11111\\t0\\tAlpha Team\\r\\n'
221+ printf 'BBBBB22222\\t0\\tBeta Team\\r\\n'` ,
222+ ) ;
223+
224+ const result = runScript ( homeDir , {
225+ IOS_PYTHON_BIN : path . join ( binDir , "fake-python" ) ,
226+ IOS_PREFERRED_TEAM_ID : "BBBBB22222" ,
227+ } ) ;
228+ expect ( result . ok ) . toBe ( true ) ;
229+ expect ( result . stdout ) . toBe ( "BBBBB22222" ) ;
230+ } ) ;
195231} ) ;
0 commit comments