@@ -6,12 +6,12 @@ import * as vscode from "vscode"
66
77import { WebAuthService } from "../../auth/WebAuthService"
88import { RefreshTimer } from "../../RefreshTimer"
9- import * as Config from "../../config"
10- import * as utils from "../../utils"
9+ import { getClerkBaseUrl , getRooCodeApiUrl } from "../../config"
10+ import { getUserAgent } from "../../utils"
1111
1212// Mock external dependencies
1313vi . mock ( "../../RefreshTimer" )
14- vi . mock ( "../../Config " )
14+ vi . mock ( "../../config " )
1515vi . mock ( "../../utils" )
1616vi . mock ( "crypto" )
1717
@@ -101,11 +101,11 @@ describe("WebAuthService", () => {
101101 MockedRefreshTimer . mockImplementation ( ( ) => mockTimer as unknown as RefreshTimer )
102102
103103 // Setup config mocks - use production URL by default to maintain existing test behavior
104- vi . mocked ( Config . getClerkBaseUrl ) . mockReturnValue ( "https://clerk.roocode.com" )
105- vi . mocked ( Config . getRooCodeApiUrl ) . mockReturnValue ( "https://api.test.com" )
104+ vi . mocked ( getClerkBaseUrl ) . mockReturnValue ( "https://clerk.roocode.com" )
105+ vi . mocked ( getRooCodeApiUrl ) . mockReturnValue ( "https://api.test.com" )
106106
107107 // Setup utils mock
108- vi . mocked ( utils . getUserAgent ) . mockReturnValue ( "Roo-Code 1.0.0" )
108+ vi . mocked ( getUserAgent ) . mockReturnValue ( "Roo-Code 1.0.0" )
109109
110110 // Setup crypto mock
111111 vi . mocked ( crypto . randomBytes ) . mockReturnValue ( Buffer . from ( "test-random-bytes" ) as never )
@@ -977,7 +977,7 @@ describe("WebAuthService", () => {
977977 describe ( "auth credentials key scoping" , ( ) => {
978978 it ( "should use default key when getClerkBaseUrl returns production URL" , async ( ) => {
979979 // Mock getClerkBaseUrl to return production URL
980- vi . mocked ( Config . getClerkBaseUrl ) . mockReturnValue ( "https://clerk.roocode.com" )
980+ vi . mocked ( getClerkBaseUrl ) . mockReturnValue ( "https://clerk.roocode.com" )
981981
982982 const service = new WebAuthService ( mockContext as unknown as vscode . ExtensionContext , mockLog )
983983 const credentials = { clientToken : "test-token" , sessionId : "test-session" }
@@ -994,7 +994,7 @@ describe("WebAuthService", () => {
994994 it ( "should use scoped key when getClerkBaseUrl returns custom URL" , async ( ) => {
995995 const customUrl = "https://custom.clerk.com"
996996 // Mock getClerkBaseUrl to return custom URL
997- vi . mocked ( Config . getClerkBaseUrl ) . mockReturnValue ( customUrl )
997+ vi . mocked ( getClerkBaseUrl ) . mockReturnValue ( customUrl )
998998
999999 const service = new WebAuthService ( mockContext as unknown as vscode . ExtensionContext , mockLog )
10001000 const credentials = { clientToken : "test-token" , sessionId : "test-session" }
@@ -1010,7 +1010,7 @@ describe("WebAuthService", () => {
10101010
10111011 it ( "should load credentials using scoped key" , async ( ) => {
10121012 const customUrl = "https://custom.clerk.com"
1013- vi . mocked ( Config . getClerkBaseUrl ) . mockReturnValue ( customUrl )
1013+ vi . mocked ( getClerkBaseUrl ) . mockReturnValue ( customUrl )
10141014
10151015 const service = new WebAuthService ( mockContext as unknown as vscode . ExtensionContext , mockLog )
10161016 const credentials = { clientToken : "test-token" , sessionId : "test-session" }
@@ -1025,7 +1025,7 @@ describe("WebAuthService", () => {
10251025
10261026 it ( "should clear credentials using scoped key" , async ( ) => {
10271027 const customUrl = "https://custom.clerk.com"
1028- vi . mocked ( Config . getClerkBaseUrl ) . mockReturnValue ( customUrl )
1028+ vi . mocked ( getClerkBaseUrl ) . mockReturnValue ( customUrl )
10291029
10301030 const service = new WebAuthService ( mockContext as unknown as vscode . ExtensionContext , mockLog )
10311031
@@ -1037,7 +1037,7 @@ describe("WebAuthService", () => {
10371037
10381038 it ( "should listen for changes on scoped key" , async ( ) => {
10391039 const customUrl = "https://custom.clerk.com"
1040- vi . mocked ( Config . getClerkBaseUrl ) . mockReturnValue ( customUrl )
1040+ vi . mocked ( getClerkBaseUrl ) . mockReturnValue ( customUrl )
10411041
10421042 let onDidChangeCallback : ( e : { key : string } ) => void
10431043
@@ -1064,7 +1064,7 @@ describe("WebAuthService", () => {
10641064
10651065 it ( "should not respond to changes on different scoped keys" , async ( ) => {
10661066 const customUrl = "https://custom.clerk.com"
1067- vi . mocked ( Config . getClerkBaseUrl ) . mockReturnValue ( customUrl )
1067+ vi . mocked ( getClerkBaseUrl ) . mockReturnValue ( customUrl )
10681068
10691069 let onDidChangeCallback : ( e : { key : string } ) => void
10701070
@@ -1088,7 +1088,7 @@ describe("WebAuthService", () => {
10881088
10891089 it ( "should not respond to changes on default key when using scoped key" , async ( ) => {
10901090 const customUrl = "https://custom.clerk.com"
1091- vi . mocked ( Config . getClerkBaseUrl ) . mockReturnValue ( customUrl )
1091+ vi . mocked ( getClerkBaseUrl ) . mockReturnValue ( customUrl )
10921092
10931093 let onDidChangeCallback : ( e : { key : string } ) => void
10941094
0 commit comments