Skip to content

Commit a1af133

Browse files
thymikeeclaude
andcommitted
test(record): freeze the clock under the 5 ms validator-run budget
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 09431c2 commit a1af133

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎packages/capture-kit/src/recording/video.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,16 @@ test('a validator run that times out reads as not playable, whatever bound stopp
190190
vi.mocked(runCmd).mockImplementation(async (_cmd, _args, options) => {
191191
throw timedOut(options!.timeoutMs!);
192192
});
193+
// A frozen clock keeps the 5 ms budget from passing before the validator runs.
194+
vi.useFakeTimers({ toFake: ['Date'] });
193195
try {
194196
await expect(isPlayableVideo(mp4, host, Deadline.fromTimeoutMs(5))).resolves.toBe(false);
195197
await expect(isPlayableVideo(mp4, host)).resolves.toBe(false);
196198
expect(vi.mocked(runCmd).mock.calls.map(([, , options]) => options?.timeoutMs)).toEqual([
197-
expect.any(Number),
198-
10_000,
199+
5, 10_000,
199200
]);
200201
} finally {
202+
vi.useRealTimers();
201203
vi.mocked(runCmd).mockReset();
202204
vi.mocked(runCmd).mockResolvedValue({ exitCode: 0, stdout: '', stderr: '' });
203205
}

0 commit comments

Comments
 (0)