@@ -101,7 +101,10 @@ describe("MiniMax provider registry", () => {
101101 return config . name === "minimax-cn" ;
102102 } ) ;
103103 expect ( cnCall ) . toBeDefined ( ) ;
104- const config = cnCall ! [ 0 ] as Record < string , unknown > ;
104+ if ( ! cnCall ) {
105+ throw new Error ( "Expected minimax-cn provider call to be recorded" ) ;
106+ }
107+ const config = cnCall [ 0 ] as Record < string , unknown > ;
105108 expect ( config . baseURL ) . toBe ( "https://api.minimaxi.com/v1" ) ;
106109 expect ( config . apiKey ) . toBe ( "test-key-minimax-cn" ) ;
107110 } ) ;
@@ -119,12 +122,17 @@ describe("MiniMax provider registry", () => {
119122 return config . name === "minimax" ;
120123 } ) ;
121124 expect ( minimaxCall ) . toBeDefined ( ) ;
122- const config = minimaxCall ! [ 0 ] as Record < string , unknown > ;
125+ if ( ! minimaxCall ) {
126+ throw new Error ( "Expected minimax provider call to be recorded" ) ;
127+ }
128+ const config = minimaxCall [ 0 ] as Record < string , unknown > ;
123129 expect ( config . baseURL ) . toBe ( "https://custom.minimax.io/v1" ) ;
124130 } ) ;
125131
126132 it ( "should throw if MINIMAX_API_KEY is not set" , async ( ) => {
127- delete process . env . MINIMAX_API_KEY ;
133+ process . env = Object . fromEntries (
134+ Object . entries ( process . env ) . filter ( ( [ key ] ) => key !== "MINIMAX_API_KEY" ) ,
135+ ) ;
128136
129137 const { ModelProviderRegistry } = await import ( "./model-provider-registry" ) ;
130138 const registry = ModelProviderRegistry . getInstance ( ) ;
0 commit comments