@@ -55,6 +55,7 @@ describe("webviewMessageHandler - requestRouterModels", () => {
5555 expect ( mockGetModels ) . toHaveBeenCalledWith ( { provider : "requesty" , apiKey : "requesty-key" } )
5656 expect ( mockGetModels ) . toHaveBeenCalledWith ( { provider : "glama" } )
5757 expect ( mockGetModels ) . toHaveBeenCalledWith ( { provider : "unbound" , apiKey : "unbound-key" } )
58+ expect ( mockGetModels ) . toHaveBeenCalledWith ( { provider : "modelharbor" } )
5859 expect ( mockGetModels ) . toHaveBeenCalledWith ( {
5960 provider : "litellm" ,
6061 apiKey : "litellm-key" ,
@@ -69,6 +70,7 @@ describe("webviewMessageHandler - requestRouterModels", () => {
6970 requesty : mockModels ,
7071 glama : mockModels ,
7172 unbound : mockModels ,
73+ modelharbor : mockModels ,
7274 litellm : mockModels ,
7375 } ,
7476 } )
@@ -154,6 +156,7 @@ describe("webviewMessageHandler - requestRouterModels", () => {
154156 requesty : mockModels ,
155157 glama : mockModels ,
156158 unbound : mockModels ,
159+ modelharbor : mockModels ,
157160 litellm : { } ,
158161 } ,
159162 } )
@@ -175,6 +178,7 @@ describe("webviewMessageHandler - requestRouterModels", () => {
175178 . mockRejectedValueOnce ( new Error ( "Requesty API error" ) ) // requesty
176179 . mockResolvedValueOnce ( mockModels ) // glama
177180 . mockRejectedValueOnce ( new Error ( "Unbound API error" ) ) // unbound
181+ . mockRejectedValueOnce ( new Error ( "LiteLLM connection failed" ) ) // modelharbor
178182 . mockRejectedValueOnce ( new Error ( "LiteLLM connection failed" ) ) // litellm
179183
180184 await webviewMessageHandler ( mockClineProvider , {
@@ -189,6 +193,7 @@ describe("webviewMessageHandler - requestRouterModels", () => {
189193 requesty : { } ,
190194 glama : mockModels ,
191195 unbound : { } ,
196+ modelharbor : { } ,
192197 litellm : { } ,
193198 } ,
194199 } )
@@ -208,6 +213,13 @@ describe("webviewMessageHandler - requestRouterModels", () => {
208213 values : { provider : "unbound" } ,
209214 } )
210215
216+ expect ( mockClineProvider . postMessageToWebview ) . toHaveBeenCalledWith ( {
217+ type : "singleRouterModelFetchResponse" ,
218+ success : false ,
219+ error : "LiteLLM connection failed" ,
220+ values : { provider : "modelharbor" } ,
221+ } )
222+
211223 expect ( mockClineProvider . postMessageToWebview ) . toHaveBeenCalledWith ( {
212224 type : "singleRouterModelFetchResponse" ,
213225 success : false ,
@@ -224,6 +236,7 @@ describe("webviewMessageHandler - requestRouterModels", () => {
224236 . mockRejectedValueOnce ( { message : "Object with message" } ) // Object error
225237 . mockResolvedValueOnce ( { } ) // Success
226238 . mockResolvedValueOnce ( { } ) // Success
239+ . mockResolvedValueOnce ( { } ) // Success
227240
228241 await webviewMessageHandler ( mockClineProvider , {
229242 type : "requestRouterModels" ,
0 commit comments