Skip to content

refactor(platform-apple): split apps.test.ts by the module each test covers - #3671

Merged
thymikee merged 1 commit into
mainfrom
refactor/split-apple-apps-test
Oct 15, 2026
Merged

thymikee merged 1 commit into
mainfrom
refactor/split-apple-apps-test

Conversation

@thymikee

@thymikee thymikee commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

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

View guided diff Turn on auto-fix

…covers

The 24 tests covered app-launch, the macOS helper, screenshot, app-resolution
and app-device-io. Each group now sits beside its module; shared mock setup is
carried only by the files that need it. Test count is 24 before and after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

View guided diff | Turn on auto-fix | Re-trigger cubic

@github-actions

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 5.25 MB 5.25 MB +15 B
Package (unpacked) 5.25 MB 5.25 MB +15 B
Package (download) 1.58 MB 1.58 MB 0 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 22.3 ms 22.4 ms +0.2 ms
CLI --help 61.5 ms 60.8 ms -0.7 ms

@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready at 1450b84. The split is test-only, and the moved test titles and added lines match the original apps.test.ts. Not blocking: packages/platform-apple/src/os/macos/helper-resolution.test.ts imports ./helper.ts, and helper.test.ts already sits beside it, so you could merge the two or keep the split as a topic split. Checks are still queued or running, and I did not run the tests myself. Typecheck and Coverage need to finish green to confirm the moved imports resolve before merge. There are no conflicts.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 15, 2026
@thymikee
thymikee merged commit 2aca915 into main Oct 15, 2026
18 checks passed
@thymikee
thymikee deleted the refactor/split-apple-apps-test branch October 15, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant