Skip to content

Commit bea6ce3

Browse files
committed
fix: adapt replay source tests to snapshot runtime
1 parent 52a467c commit bea6ce3

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎src/daemon/handlers/__tests__/session-replay-script-source.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ vi.mock('../../../core/dispatch.ts', async (importOriginal) => {
1212
const actual = await importOriginal<typeof import('../../../core/dispatch.ts')>();
1313
return { ...actual, dispatchCommand: vi.fn(async () => ({})), resolveTargetDevice: vi.fn() };
1414
});
15+
vi.mock('../snapshot-interactor-capture.ts', () => ({
16+
captureSnapshotWithInteractor: vi.fn(),
17+
}));
1518

1619
import fs from 'node:fs';
1720
import path from 'node:path';
@@ -24,10 +27,16 @@ import {
2427
replayScriptSourceBundleFor,
2528
} from '../../../__tests__/test-utils/replay-script-source.ts';
2629
import { REPLAY_SCRIPT_SOURCE_REQUIRED_MESSAGE } from '../../../replay/script-source-bundle.ts';
30+
import { captureSnapshotThroughLegacyDispatchFixture } from '../../__tests__/legacy-snapshot-capture-fixture.ts';
31+
import { captureSnapshotWithInteractor } from '../snapshot-interactor-capture.ts';
32+
33+
const mockCaptureSnapshotWithInteractor = vi.mocked(captureSnapshotWithInteractor);
2734

2835
beforeEach(() => {
2936
vi.mocked(dispatchCommand).mockReset();
3037
vi.mocked(dispatchCommand).mockResolvedValue({});
38+
mockCaptureSnapshotWithInteractor.mockReset();
39+
mockCaptureSnapshotWithInteractor.mockImplementation(captureSnapshotThroughLegacyDispatchFixture);
3140
});
3241

3342
test('a bundled replay runs after the script file is gone from the daemon host', async () => {

0 commit comments

Comments
 (0)