Skip to content

Commit c67877e

Browse files
committed
fix test
1 parent 7e3cdb1 commit c67877e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/unit/telemetry.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ describe("Telemetry", () => {
274274
it("should timeout if machine ID resolution takes too long", async () => {
275275
const loggerSpy = jest.spyOn(logger, "debug");
276276

277+
jest.useFakeTimers();
278+
277279
telemetry = Telemetry.create(session, config, {
278280
...telemetryConfig,
279281
getRawMachineId: () => new Promise(() => {}), // Never resolves
@@ -283,7 +285,11 @@ describe("Telemetry", () => {
283285

284286
telemetry.emitEvents([testEvent]);
285287

286-
await delay(5000); // Wait for timeout
288+
jest.advanceTimersByTime(5000);
289+
290+
jest.useRealTimers();
291+
292+
expect(loggerSpy).toHaveBeenCalledTimes(2);
287293

288294
expect(loggerSpy).toHaveBeenNthCalledWith(
289295
2,

0 commit comments

Comments
 (0)