Skip to content

Commit b6f0703

Browse files
thymikeeclaude
andauthored
refactor(move): move the Android capture-failure-reason test into platform-android (#3678)
* refactor(test): move the Android capture-failure-reason test into platform-android (pure git mv) Specifier fixes follow in the next commit. Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor(test): use the platform-android test host and relative imports in the moved test Specifier-only edits. Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor(test): drop the dead host-kit runCmd mock from the moved test No case reaches runCmd: every adb call goes through the injected executor, and the test passes 5/5 without the mock, before and after the move. The afterEach that only cleared it goes with it. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 58edfad commit b6f0703

1 file changed

Lines changed: 6 additions & 18 deletions

File tree

src/__tests__/android-snapshot-capture-failure-reason.test.ts renamed to packages/platform-android/src/__tests__/snapshot-capture-failure-reason.test.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
import { afterEach, beforeEach, test, vi } from 'vitest';
1+
import { beforeEach, test } from 'vitest';
22
import assert from 'node:assert/strict';
33
import type { DeviceInfo } from '@agent-device/kernel/device';
44
import { normalizeError } from '@agent-device/kernel/errors';
55
import { isAndroidCaptureFailureReason } from '@agent-device/contracts/android-snapshot-quality';
6-
import {
7-
snapshotAndroid,
8-
type AndroidAdbExecutor,
9-
type AndroidAdbExecutorResult,
10-
resetAndroidSnapshotHelperInstallCache,
11-
resetAndroidSnapshotHelperSessions,
12-
} from '@agent-device/platform-android/mechanics';
6+
import type { AndroidAdbExecutor, AndroidAdbExecutorResult } from '../adb-executor.ts';
7+
import { snapshotAndroid } from '../snapshot.ts';
8+
import { resetAndroidSnapshotHelperInstallCache } from '../snapshot-helper-install.ts';
9+
import { resetAndroidSnapshotHelperSessions } from '../snapshot-helper-session-lifecycle.ts';
1310
import { ANDROID_SNAPSHOT_HELPER_FIXTURE_ARTIFACT } from './test-utils/android-snapshot-helper.ts';
1411
import { isAndroidSnapshotTimeoutError } from '@agent-device/capture-kit/snapshot-timeout-policy';
15-
import '../platform-runtime-android-adb-host.ts';
12+
import './test-utils/android-host-test-setup.ts';
1613

1714
/**
1815
* The Android capture-failure-reason contract, from producer to consumer.
@@ -24,11 +21,6 @@ import '../platform-runtime-android-adb-host.ts';
2421
* value it publishes. Split out of `snapshot.test.ts`, which is over the file-size tripwire.
2522
*/
2623

27-
vi.mock('@agent-device/host-kit/command', async (importOriginal) => ({
28-
...(await importOriginal<typeof import('@agent-device/host-kit/command')>()),
29-
runCmd: vi.fn(),
30-
}));
31-
3224
const device: DeviceInfo = {
3325
platform: 'android',
3426
id: 'emulator-5554',
@@ -44,10 +36,6 @@ beforeEach(() => {
4436
resetAndroidSnapshotHelperSessions();
4537
});
4638

47-
afterEach(() => {
48-
vi.clearAllMocks();
49-
});
50-
5139
function snapshotAndroidWithHelper(helperAdb: AndroidAdbExecutor) {
5240
return snapshotAndroid(device, { helperAdb, helperArtifact });
5341
}

0 commit comments

Comments
 (0)