test(commands): cover gesture, settle-baseline, appstate, alert-wait, and JSON-object branches
Merged
TH
2mo ago+325+325+012345678901234567890123456789-1-1-0123456789
Summary
Burns down the five coverage-based CRAP findings in #3422 by covering their uncovered branches through each owning module's public entry point (no new production exports, no test-only DI). 5 test files, one new (interaction/index.test.ts mirrors interaction/index.ts); no production-code changes. Gross diff ~325 lines.
| Function | Before | After |
|---|---|---|
cli-grammar/common.ts:227 readJsonObject | 30 (0%) | 5 (100%) |
interaction/index.ts:619 run (gesture dispatch) | 35 (25%) | 8 (100%) |
interaction/runtime/settle.ts:249 sessionBaseline | 30 (0%) | 5 (100%) |
system/output.ts:67 formatAppleAppState | 42 (0%) | 6 (100%) |
system/runtime/system.ts:448 normalizeAlertWaitResult | 30 (0%) | 5 (100%) |
readJsonObject: accept + all refusal shapes, tested incommon.test.ts.- Gesture
run: all seven kinds routed via the family definition'sinvoke(the real dispatch path), pinning both theclient.interactions.*method and the projected options for each kind. sessionBaseline: ref-frame / snapshot / empty pre-frame chain throughsettleAfterInteractionwith a point target; a??swap mutation fails the ref-frame test.formatAppleAppState: runner/session/no-identity renders throughsystemCliOutputFormatters.appstate.normalizeAlertWaitResult: visible / timed-out / no-timing-fields / wrong-kind refusal (typedBackendAlertResultdouble, assertingCOMMAND_FAILED) throughdevice.system.alert.
Validation
Tested SHA ffd2f0590: pnpm format and pnpm check:affected --run (under the machine lock) pass. Per-file vitest related + pnpm check:coverage-crap --all over the five owned files: no function at or above CRAP 30 (before: all five listed); CI's Coverage CRAP step confirmed the same at 06d2bb965. Mutation checks: swapping sessionBaseline's ?? order and flipping the alert code both fail their tests. No baseline/gate files touched.