@@ -106,7 +106,7 @@ describe("ConfigManager", () => {
106106
107107 mockSecrets . get . mockResolvedValue ( JSON . stringify ( existingConfig ) )
108108
109- const configs = await configManager . ListConfig ( )
109+ const configs = await configManager . listConfig ( )
110110 expect ( configs ) . toEqual ( [
111111 { name : "default" , id : "default" , apiProvider : undefined } ,
112112 { name : "test" , id : "test-id" , apiProvider : "anthropic" } ,
@@ -126,14 +126,14 @@ describe("ConfigManager", () => {
126126
127127 mockSecrets . get . mockResolvedValue ( JSON . stringify ( emptyConfig ) )
128128
129- const configs = await configManager . ListConfig ( )
129+ const configs = await configManager . listConfig ( )
130130 expect ( configs ) . toEqual ( [ ] )
131131 } )
132132
133133 it ( "should throw error if reading from secrets fails" , async ( ) => {
134134 mockSecrets . get . mockRejectedValue ( new Error ( "Read failed" ) )
135135
136- await expect ( configManager . ListConfig ( ) ) . rejects . toThrow (
136+ await expect ( configManager . listConfig ( ) ) . rejects . toThrow (
137137 "Failed to list configs: Error: Failed to read config from secrets: Error: Read failed" ,
138138 )
139139 } )
@@ -160,7 +160,7 @@ describe("ConfigManager", () => {
160160 apiKey : "test-key" ,
161161 }
162162
163- await configManager . SaveConfig ( "test" , newConfig )
163+ await configManager . saveConfig ( "test" , newConfig )
164164
165165 // Get the actual stored config to check the generated ID
166166 const storedConfig = JSON . parse ( mockSecrets . store . mock . calls [ 0 ] [ 1 ] )
@@ -207,7 +207,7 @@ describe("ConfigManager", () => {
207207 apiKey : "new-key" ,
208208 }
209209
210- await configManager . SaveConfig ( "test" , updatedConfig )
210+ await configManager . saveConfig ( "test" , updatedConfig )
211211
212212 const expectedConfig = {
213213 currentApiConfigName : "default" ,
@@ -235,7 +235,7 @@ describe("ConfigManager", () => {
235235 )
236236 mockSecrets . store . mockRejectedValueOnce ( new Error ( "Storage failed" ) )
237237
238- await expect ( configManager . SaveConfig ( "test" , { } ) ) . rejects . toThrow (
238+ await expect ( configManager . saveConfig ( "test" , { } ) ) . rejects . toThrow (
239239 "Failed to save config: Error: Failed to write config to secrets: Error: Storage failed" ,
240240 )
241241 } )
@@ -258,7 +258,7 @@ describe("ConfigManager", () => {
258258
259259 mockSecrets . get . mockResolvedValue ( JSON . stringify ( existingConfig ) )
260260
261- await configManager . DeleteConfig ( "test" )
261+ await configManager . deleteConfig ( "test" )
262262
263263 // Get the stored config to check the ID
264264 const storedConfig = JSON . parse ( mockSecrets . store . mock . calls [ 0 ] [ 1 ] )
@@ -275,7 +275,7 @@ describe("ConfigManager", () => {
275275 } ) ,
276276 )
277277
278- await expect ( configManager . DeleteConfig ( "nonexistent" ) ) . rejects . toThrow ( "Config 'nonexistent' not found" )
278+ await expect ( configManager . deleteConfig ( "nonexistent" ) ) . rejects . toThrow ( "Config 'nonexistent' not found" )
279279 } )
280280
281281 it ( "should throw error when trying to delete last remaining config" , async ( ) => {
@@ -290,7 +290,7 @@ describe("ConfigManager", () => {
290290 } ) ,
291291 )
292292
293- await expect ( configManager . DeleteConfig ( "default" ) ) . rejects . toThrow (
293+ await expect ( configManager . deleteConfig ( "default" ) ) . rejects . toThrow (
294294 "Cannot delete the last remaining configuration." ,
295295 )
296296 } )
@@ -311,7 +311,7 @@ describe("ConfigManager", () => {
311311
312312 mockSecrets . get . mockResolvedValue ( JSON . stringify ( existingConfig ) )
313313
314- const config = await configManager . LoadConfig ( "test" )
314+ const config = await configManager . loadConfig ( "test" )
315315
316316 expect ( config ) . toEqual ( {
317317 apiProvider : "anthropic" ,
@@ -342,7 +342,7 @@ describe("ConfigManager", () => {
342342 } ) ,
343343 )
344344
345- await expect ( configManager . LoadConfig ( "nonexistent" ) ) . rejects . toThrow ( "Config 'nonexistent' not found" )
345+ await expect ( configManager . loadConfig ( "nonexistent" ) ) . rejects . toThrow ( "Config 'nonexistent' not found" )
346346 } )
347347
348348 it ( "should throw error if secrets storage fails" , async ( ) => {
@@ -361,7 +361,7 @@ describe("ConfigManager", () => {
361361 )
362362 mockSecrets . store . mockRejectedValueOnce ( new Error ( "Storage failed" ) )
363363
364- await expect ( configManager . LoadConfig ( "test" ) ) . rejects . toThrow (
364+ await expect ( configManager . loadConfig ( "test" ) ) . rejects . toThrow (
365365 "Failed to load config: Error: Failed to write config to secrets: Error: Storage failed" ,
366366 )
367367 } )
@@ -384,7 +384,7 @@ describe("ConfigManager", () => {
384384
385385 mockSecrets . get . mockResolvedValue ( JSON . stringify ( existingConfig ) )
386386
387- await configManager . SetCurrentConfig ( "test" )
387+ await configManager . setCurrentConfig ( "test" )
388388
389389 // Get the stored config to check the structure
390390 const storedConfig = JSON . parse ( mockSecrets . store . mock . calls [ 0 ] [ 1 ] )
@@ -404,7 +404,7 @@ describe("ConfigManager", () => {
404404 } ) ,
405405 )
406406
407- await expect ( configManager . SetCurrentConfig ( "nonexistent" ) ) . rejects . toThrow (
407+ await expect ( configManager . setCurrentConfig ( "nonexistent" ) ) . rejects . toThrow (
408408 "Config 'nonexistent' not found" ,
409409 )
410410 } )
@@ -420,12 +420,34 @@ describe("ConfigManager", () => {
420420 )
421421 mockSecrets . store . mockRejectedValueOnce ( new Error ( "Storage failed" ) )
422422
423- await expect ( configManager . SetCurrentConfig ( "test" ) ) . rejects . toThrow (
423+ await expect ( configManager . setCurrentConfig ( "test" ) ) . rejects . toThrow (
424424 "Failed to set current config: Error: Failed to write config to secrets: Error: Storage failed" ,
425425 )
426426 } )
427427 } )
428428
429+ describe ( "ResetAllConfigs" , ( ) => {
430+ it ( "should delete all stored configs" , async ( ) => {
431+ // Setup initial config
432+ mockSecrets . get . mockResolvedValue (
433+ JSON . stringify ( {
434+ currentApiConfigName : "test" ,
435+ apiConfigs : {
436+ test : {
437+ apiProvider : "anthropic" ,
438+ id : "test-id" ,
439+ } ,
440+ } ,
441+ } ) ,
442+ )
443+
444+ await configManager . resetAllConfigs ( )
445+
446+ // Should have called delete with the correct config key
447+ expect ( mockSecrets . delete ) . toHaveBeenCalledWith ( "roo_cline_config_api_config" )
448+ } )
449+ } )
450+
429451 describe ( "HasConfig" , ( ) => {
430452 it ( "should return true for existing config" , async ( ) => {
431453 const existingConfig : ApiConfigData = {
@@ -443,7 +465,7 @@ describe("ConfigManager", () => {
443465
444466 mockSecrets . get . mockResolvedValue ( JSON . stringify ( existingConfig ) )
445467
446- const hasConfig = await configManager . HasConfig ( "test" )
468+ const hasConfig = await configManager . hasConfig ( "test" )
447469 expect ( hasConfig ) . toBe ( true )
448470 } )
449471
@@ -455,14 +477,14 @@ describe("ConfigManager", () => {
455477 } ) ,
456478 )
457479
458- const hasConfig = await configManager . HasConfig ( "nonexistent" )
480+ const hasConfig = await configManager . hasConfig ( "nonexistent" )
459481 expect ( hasConfig ) . toBe ( false )
460482 } )
461483
462484 it ( "should throw error if secrets storage fails" , async ( ) => {
463485 mockSecrets . get . mockRejectedValue ( new Error ( "Storage failed" ) )
464486
465- await expect ( configManager . HasConfig ( "test" ) ) . rejects . toThrow (
487+ await expect ( configManager . hasConfig ( "test" ) ) . rejects . toThrow (
466488 "Failed to check config existence: Error: Failed to read config from secrets: Error: Storage failed" ,
467489 )
468490 } )
0 commit comments