@@ -4,6 +4,7 @@ import { Telemetry } from "../../src/telemetry/telemetry.js";
44import { BaseEvent , TelemetryResult } from "../../src/telemetry/types.js" ;
55import { EventCache } from "../../src/telemetry/eventCache.js" ;
66import { config } from "../../src/config.js" ;
7+ import { jest } from "@jest/globals" ;
78
89// Mock the ApiClient to avoid real API calls
910jest . mock ( "../../src/common/atlas/apiClient.js" ) ;
@@ -93,22 +94,29 @@ describe("Telemetry", () => {
9394
9495 // Setup mocked API client
9596 mockApiClient = new MockApiClient ( { baseUrl : "" } ) as jest . Mocked < ApiClient > ;
96- mockApiClient . sendEvents = jest . fn ( ) . mockResolvedValue ( undefined ) ;
97- mockApiClient . hasCredentials = jest . fn ( ) . mockReturnValue ( true ) ;
97+ //@ts -expect-error This is a workaround
98+ mockApiClient . sendEvents = jest . fn < ( ) => undefined > ( ) . mockResolvedValue ( undefined ) ;
99+ mockApiClient . hasCredentials = jest . fn < ( ) => boolean > ( ) . mockReturnValue ( true ) ;
98100
99101 // Setup mocked EventCache
100102 mockEventCache = new MockEventCache ( ) as jest . Mocked < EventCache > ;
103+ //@ts -expect-error This is a workaround
101104 mockEventCache . getEvents = jest . fn ( ) . mockReturnValue ( [ ] ) ;
105+ //@ts -expect-error This is a workaround
102106 mockEventCache . clearEvents = jest . fn ( ) . mockResolvedValue ( undefined ) ;
107+ //@ts -expect-error This is a workaround
103108 mockEventCache . appendEvents = jest . fn ( ) . mockResolvedValue ( undefined ) ;
109+ //@ts -expect-error This is a workaround
104110 MockEventCache . getInstance = jest . fn ( ) . mockReturnValue ( mockEventCache ) ;
105111
106112 // Create a simplified session with our mocked API client
107113 session = {
108114 apiClient : mockApiClient ,
109115 sessionId : "test-session-id" ,
110116 agentRunner : { name : "test-agent" , version : "1.0.0" } as const ,
117+ //@ts -expect-error This is a workaround
111118 close : jest . fn ( ) . mockResolvedValue ( undefined ) ,
119+ //@ts -expect-error This is a workaround
112120 setAgentRunner : jest . fn ( ) . mockResolvedValue ( undefined ) ,
113121 } as unknown as Session ;
114122
0 commit comments