Skip to content

Commit b73dd01

Browse files
committed
test(daemon): stub the dialog probe where this branch moved it
PR #2003 CI, coverage shard: 'request router joins orientation admission to execution and ref invalidation' failed with `{ ok: false, error }` where it expects `{ ok: true, data }`. `orientation` carries `androidBlockingDialogGuard: true`, so the router runs the real `ensureNoAndroidBlockingDialogReady` check for this file's Android device. This branch moved `getAndroidBlockingDialogObservation` out of `app-lifecycle.ts` and into `window-state.ts`, which answers every window question from one dumpsys read. The sibling suites moved their stubs with it; this one kept aiming at the old module, where the spread only added a key nothing imports. The stub was a silent no-op and the real `adb` spawn ran. A host with `adb` on PATH still passed: no such device, empty dump, `unknown` status, warning path, `ok: true`. A runner without `adb` fails the spawn instead, and the guard's catch turns that into an error response — the shard's failure. Reproduced locally by dropping `adb` from PATH, which gives the CI assertion verbatim; green there after the fix, and the case drops from 939ms to 9ms now that it no longer spawns `adb` twice. Production is unchanged: the guard is correct to gate orientation, which is state-changing and would otherwise rotate behind a blocking dialog (#1832, #592). Only the test's seam pin was stale.
1 parent 394f949 commit b73dd01

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎src/daemon/__tests__/orientation-runtime.test.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ import { expect, test, vi } from 'vitest';
66
// probe the same way `request-router-android-modal.test.ts` does, so that check short-circuits to
77
// "clear" without spawning `adb` — matching the daemon's own real guard seam instead of dodging
88
// the device platform this test is named for.
9-
vi.mock('../../platforms/android/app-lifecycle.ts', async (importOriginal) => {
10-
const actual = await importOriginal<typeof import('../../platforms/android/app-lifecycle.ts')>();
9+
//
10+
// The probe is owned by `window-state.ts`, which answers every window question from one dumpsys
11+
// read; a stub aimed at the module it used to live in is a silent no-op, because the spread only
12+
// adds a key nothing imports and the real spawn still runs.
13+
vi.mock('../../platforms/android/window-state.ts', async (importOriginal) => {
14+
const actual = await importOriginal<typeof import('../../platforms/android/window-state.ts')>();
1115
return {
1216
...actual,
1317
getAndroidBlockingDialogObservation: vi.fn(async () => ({ status: 'clear' }) as const),

0 commit comments

Comments
 (0)