Repository navigation
test(commands): cover gesture, settle-baseline, appstate, alert-wait, and JSON-object branches - #3438
Conversation
…, and alert-wait branches Burn down the coverage-based CRAP findings from #3422: - readJsonObject: accept/refuse table through the cli-grammar reader - gesture run: all seven kinds routed through the family definition's invoke - sessionBaseline: ref-frame, snapshot, and pre-frame-empty chains through settleAfterInteraction with a point target - formatAppleAppState: runner/session/unknown renders through the appstate CLI output formatter - normalizeAlertWaitResult: visible and timed-out projections plus the wrong-kind refusal through the runtime alert command
Size Report
Startup median (7 runs, lower is better):
|
|
This PR is ready at 06d2bb9. The diff is test-only, all 18 checks pass, and no open reviewer threads remain. There are no conflicts. I did not run the tests, the mutation checks or the coverage-CRAP gate, and the CRAP before and after numbers are your local measurement. I also did not check that the settle fixtures behave exactly as the assertions assume, so I relied on CI being green for that. Not blocking: in https://github.com/callstack/agent-device/blob/06d2bb9/src/commands/system/runtime/system.test.ts#L123 the backend double and the wrong-kind alert case return |
…re option projection Review follow-up on #3438: - the alert-wait backend double returns BackendAlertResult values, dropping the `as never` casts, and the wrong-kind refusal asserts the typed COMMAND_FAILED code alongside the message - the gesture routing table now asserts the projected client options for every kind (fling, swipe, rotate, and transform had no toXOptions mapping test in gesture.test.ts)
|
Both review items addressed in
Still test-only. |
|
|
The earlier clean review of 06d2bb9 still holds, and I found no problems in the new tests at ffd2f05. This change is test-only (+0/-0 production lines), and the new cases match the head index.ts projections as I read them. All 18 checks pass and there are no conflicts. I read the diff but did not run the tests on this head, and I did not re-run the mutation check that flips the thrown code to INVALID_ARGS. No review threads are open, so nothing else is needed before merge. |
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.tsmirrorsinteraction/index.ts); no production-code changes. Gross diff ~325 lines.cli-grammar/common.ts:227readJsonObjectinteraction/index.ts:619run(gesture dispatch)interaction/runtime/settle.ts:249sessionBaselinesystem/output.ts:67formatAppleAppStatesystem/runtime/system.ts:448normalizeAlertWaitResultreadJsonObject: accept + all refusal shapes, tested incommon.test.ts.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.Closes #3422, part of #3414.
Validation
Tested SHA
ffd2f0590:pnpm formatandpnpm check:affected --run(under the machine lock) pass. Per-filevitest related+pnpm check:coverage-crap --allover the five owned files: no function at or above CRAP 30 (before: all five listed); CI's Coverage CRAP step confirmed the same at06d2bb965. Mutation checks: swappingsessionBaseline's??order and flipping the alert code both fail their tests. No baseline/gate files touched.