fix(ios): normalize team IDs before preferred match

Co-authored-by: Brian Leach <bleach@gmail.com>
This commit is contained in:
Peter Steinberger
2026-02-24 14:53:07 +00:00
parent 1ae8c0a589
commit 069c56cd75
2 changed files with 41 additions and 0 deletions

View File

@@ -192,4 +192,40 @@ exit 0`,
expect(result.ok).toBe(true);
expect(result.stdout).toBe("BBBBB22222");
});
it("matches preferred team IDs even when parser output uses CRLF line endings", async () => {
const homeDir = await mkdtemp(path.join(os.tmpdir(), "openclaw-ios-team-id-"));
const binDir = path.join(homeDir, "bin");
await mkdir(binDir, { recursive: true });
await mkdir(path.join(homeDir, "Library", "Preferences"), { recursive: true });
await writeFile(path.join(homeDir, "Library", "Preferences", "com.apple.dt.Xcode.plist"), "");
await writeExecutable(
path.join(binDir, "plutil"),
`#!/usr/bin/env bash
echo '{}'`,
);
await writeExecutable(
path.join(binDir, "defaults"),
`#!/usr/bin/env bash
if [[ "$3" == "DVTDeveloperAccountManagerAppleIDLists" ]]; then
echo '(identifier = "dev@example.com";)'
exit 0
fi
exit 0`,
);
await writeExecutable(
path.join(binDir, "fake-python"),
`#!/usr/bin/env bash
printf 'AAAAA11111\\t0\\tAlpha Team\\r\\n'
printf 'BBBBB22222\\t0\\tBeta Team\\r\\n'`,
);
const result = runScript(homeDir, {
IOS_PYTHON_BIN: path.join(binDir, "fake-python"),
IOS_PREFERRED_TEAM_ID: "BBBBB22222",
});
expect(result.ok).toBe(true);
expect(result.stdout).toBe("BBBBB22222");
});
});