refactor(platform-apple): split apps.test.ts by the module each test covers
Summary
platform-apple/src/core/__tests__/apps.test.ts (24 tests, 674 lines) covered six modules and sat beside none of them. It is split so each group sits beside the module it exercises. This was the largest remaining colocation offender in platform-apple (with #3657 the package reaches 0).
This is a split, not a move: one commit, all content is relocated test bodies verbatim plus the minimum scaffolding each file needs.
Split
| New file | Tests | Module under test |
|---|---|---|
core/__tests__/app-launch-open.test.ts | 13 (openIosApp) | core/app-launch.ts |
core/__tests__/app-launch-close-quit.test.ts | 2 (closeIosApp on macOS helper quit, simulator terminate bound) | core/app-launch.ts |
core/__tests__/screenshot-simulator-capture.test.ts | 2 (screenshotIos retry, pixel density) | core/screenshot.ts |
core/__tests__/app-resolution-display-name.test.ts | 3 (resolveIosApp ร2, resolveIosSimulatorDeepLinkBundleId) | core/app-resolution.ts |
core/__tests__/app-device-io-physical-device.test.ts | 1 (readIosClipboardText) | core/app-device-io.ts |
os/macos/helper-resolution.test.ts | 3 (resolveMacOsHelperPackageRootFrom, relative AGENT_DEVICE_MACOS_HELPER_BIN, quitMacOsApp validation) | os/macos/helper.ts |
Mock setup is carried only where used: the runCmd/ensureBootedSimulator mocks and beforeEach live in the open and close files, the retryWithPolicy mock only in the screenshot file, and the resolution, clipboard and helper files use none (their tests ran the pass-through mock's real implementation).
Test-count parity (vitest --reporter=json)
apps.test.ts 24/24 โ 13 + 2 + 2 + 3 + 1 + 3 = 24/24 across 6 files. All new files are under packages/platform-apple/src/**, so unit-core selects them; check:affected --run passed with them selected.
vi.mock effectiveness
Each mock swapped for a module that does not provide the behavior, one at a time, then reverted:
| File | Mock | Result |
|---|---|---|
app-launch-open | @agent-device/host-kit/command | 13 failed / 13 |
../simulator.ts | 13 failed / 13 | |
app-launch-close-quit | @agent-device/host-kit/command | 2 failed / 2 |
../simulator.ts | 2 failed / 2 | |
screenshot-simulator-capture | @agent-device/host-kit/retry | 2 failed / 2 |
Surface
exports unchanged (no manifest touched). Colocation offenders: apps.test.ts removed; the file's six replacements are all module-named.
Gates
pnpm check:quick, check:layering, check:fallow, check:gate-manifest and check:affected --run all exit 0 on this head; pnpm format leaves a clean tree.
๐ค Generated with Claude Code