@@ -1652,3 +1652,62 @@ describe("ContextProxy integration", () => {
16521652 expect ( mockContextProxy . setValues ) . toBeDefined ( )
16531653 } )
16541654} )
1655+
1656+ describe ( "getTelemetryProperties" , ( ) => {
1657+ let provider : ClineProvider
1658+ let mockContext : vscode . ExtensionContext
1659+ let mockOutputChannel : vscode . OutputChannel
1660+ let mockCline : any
1661+
1662+ beforeEach ( ( ) => {
1663+ // Reset mocks
1664+ jest . clearAllMocks ( )
1665+
1666+ // Setup basic mocks
1667+ mockContext = {
1668+ globalState : {
1669+ get : jest . fn ( ) . mockImplementation ( ( key : string ) => {
1670+ if ( key === "mode" ) return "code"
1671+ if ( key === "apiProvider" ) return "anthropic"
1672+ return undefined
1673+ } ) ,
1674+ update : jest . fn ( ) ,
1675+ keys : jest . fn ( ) . mockReturnValue ( [ ] ) ,
1676+ } ,
1677+ secrets : { get : jest . fn ( ) , store : jest . fn ( ) , delete : jest . fn ( ) } ,
1678+ extensionUri : { } as vscode . Uri ,
1679+ globalStorageUri : { fsPath : "/test/path" } ,
1680+ extension : { packageJSON : { version : "1.0.0" } } ,
1681+ } as unknown as vscode . ExtensionContext
1682+
1683+ mockOutputChannel = { appendLine : jest . fn ( ) } as unknown as vscode . OutputChannel
1684+ provider = new ClineProvider ( mockContext , mockOutputChannel )
1685+
1686+ // Setup Cline instance with mocked getModel method
1687+ const { Cline } = require ( "../../Cline" )
1688+ mockCline = new Cline ( )
1689+ mockCline . api = {
1690+ getModel : jest . fn ( ) . mockReturnValue ( {
1691+ id : "claude-3-7-sonnet-20250219" ,
1692+ info : { contextWindow : 200000 } ,
1693+ } ) ,
1694+ }
1695+ } )
1696+
1697+ test ( "includes basic properties in telemetry" , async ( ) => {
1698+ const properties = await provider . getTelemetryProperties ( )
1699+
1700+ expect ( properties ) . toHaveProperty ( "vscodeVersion" )
1701+ expect ( properties ) . toHaveProperty ( "platform" )
1702+ expect ( properties ) . toHaveProperty ( "appVersion" , "1.0.0" )
1703+ } )
1704+
1705+ test ( "includes model ID from current Cline instance if available" , async ( ) => {
1706+ // Add mock Cline to stack
1707+ await provider . addClineToStack ( mockCline )
1708+
1709+ const properties = await provider . getTelemetryProperties ( )
1710+
1711+ expect ( properties ) . toHaveProperty ( "modelId" , "claude-3-7-sonnet-20250219" )
1712+ } )
1713+ } )
0 commit comments