@@ -130,6 +130,46 @@ describe("registerCommand", () => {
130130 ) ;
131131 } ) ;
132132
133+ it ( "formats empty providers, unknown tiers, and api-key auth headers" , async ( ) => {
134+ mockVerify . mockResolvedValueOnce ( {
135+ endpointReachable : true ,
136+ authValid : true ,
137+ agentName : null ,
138+ error : null ,
139+ } ) ;
140+ mockFetch . mockResolvedValueOnce ( {
141+ ok : true ,
142+ json : async ( ) => ( {
143+ agentName : "custom-agent" ,
144+ providers : [ ] ,
145+ tiers : [
146+ { tier : "custom" , model : null , source : "auto" , fallback_models : [ ] } ,
147+ ] ,
148+ } ) ,
149+ } ) ;
150+
151+ const api = { registerCommand : jest . fn ( ) } ;
152+ registerCommand (
153+ api ,
154+ { ...config , apiKey : "mnfst_test_key" , devMode : false } ,
155+ mockLogger ,
156+ ) ;
157+
158+ const cmd = api . registerCommand . mock . calls [ 0 ] [ 0 ] ;
159+ const result = await cmd . execute ( ) ;
160+
161+ expect ( result ) . toContain ( "Dev mode: no" ) ;
162+ expect ( result ) . toContain ( "Agent: custom-agent" ) ;
163+ expect ( result ) . toContain ( "Providers: none" ) ;
164+ expect ( result ) . toContain ( "custom -> unassigned (auto)" ) ;
165+ expect ( mockFetch ) . toHaveBeenCalledWith (
166+ "http://localhost:38238/api/v1/routing/summary" ,
167+ expect . objectContaining ( {
168+ headers : { Authorization : "Bearer mnfst_test_key" } ,
169+ } ) ,
170+ ) ;
171+ } ) ;
172+
133173 it ( "falls back to status output when the routing summary request fails" , async ( ) => {
134174 mockVerify . mockResolvedValueOnce ( {
135175 endpointReachable : true ,
@@ -153,6 +193,26 @@ describe("registerCommand", () => {
153193 ) ;
154194 } ) ;
155195
196+ it ( "stringifies non-Error routing summary failures" , async ( ) => {
197+ mockVerify . mockResolvedValueOnce ( {
198+ endpointReachable : true ,
199+ authValid : true ,
200+ agentName : "test-agent" ,
201+ error : null ,
202+ } ) ;
203+ mockFetch . mockRejectedValueOnce ( "summary-string-error" ) ;
204+
205+ const api = { registerCommand : jest . fn ( ) } ;
206+ registerCommand ( api , config , mockLogger ) ;
207+
208+ const cmd = api . registerCommand . mock . calls [ 0 ] [ 0 ] ;
209+ await cmd . execute ( ) ;
210+
211+ expect ( mockLogger . debug ) . toHaveBeenCalledWith (
212+ "[manifest] Routing summary failed (summary-string-error)" ,
213+ ) ;
214+ } ) ;
215+
156216 it ( "includes error in status text when verify reports one" , async ( ) => {
157217 mockVerify . mockResolvedValueOnce ( {
158218 endpointReachable : false ,
0 commit comments