@@ -80,10 +80,9 @@ describe("configOverrides", () => {
8080 ...baseConfig ,
8181 allowRequestOverrides : false ,
8282 } as UserConfig ;
83- const result = applyConfigOverrides ( { baseConfig : configWithOverridesDisabled , request } ) ;
84- // Config should remain unchanged
85- expect ( result . readOnly ) . toBe ( false ) ;
86- expect ( result . idleTimeoutMs ) . toBe ( 600_000 ) ;
83+ expect ( ( ) => applyConfigOverrides ( { baseConfig : configWithOverridesDisabled , request } ) ) . to . throw (
84+ "Request overrides are not enabled"
85+ ) ;
8786 } ) ;
8887
8988 it ( "should apply overrides when allowRequestOverrides is true" , ( ) => {
@@ -107,9 +106,9 @@ describe("configOverrides", () => {
107106 } ;
108107 // eslint-disable-next-line @typescript-eslint/no-unused-vars
109108 const { allowRequestOverrides, ...configWithoutOverridesFlag } = baseConfig ;
110- const result = applyConfigOverrides ( { baseConfig : configWithoutOverridesFlag as UserConfig , request } ) ;
111- // Should not apply overrides since the default is false
112- expect ( result . readOnly ) . toBe ( false ) ;
109+ expect ( ( ) =>
110+ applyConfigOverrides ( { baseConfig : configWithoutOverridesFlag as UserConfig , request } )
111+ ) . to . throw ( "Request overrides are not enabled" ) ;
113112 } ) ;
114113 } ) ;
115114
@@ -254,7 +253,7 @@ describe("configOverrides", () => {
254253 const request : RequestContext = { headers : { "x-mongodb-mcp-read-only" : "false" } } ;
255254 expect ( ( ) =>
256255 applyConfigOverrides ( { baseConfig : { ...baseConfig , readOnly : true } as UserConfig , request } )
257- ) . toThrow ( "Cannot apply override for readOnly from true to false : Can only set to true" ) ;
256+ ) . toThrow ( "Cannot apply override for readOnly: Can only set to true" ) ;
258257 } ) ;
259258
260259 it ( "should allow indexCheck override from false to true" , ( ) => {
@@ -270,7 +269,7 @@ describe("configOverrides", () => {
270269 const request : RequestContext = { headers : { "x-mongodb-mcp-index-check" : "false" } } ;
271270 expect ( ( ) =>
272271 applyConfigOverrides ( { baseConfig : { ...baseConfig , indexCheck : true } as UserConfig , request } )
273- ) . toThrow ( "Cannot apply override for indexCheck from true to false : Can only set to true" ) ;
272+ ) . toThrow ( "Cannot apply override for indexCheck: Can only set to true" ) ;
274273 } ) ;
275274
276275 it ( "should allow disableEmbeddingsValidation override from true to false" , ( ) => {
@@ -289,9 +288,7 @@ describe("configOverrides", () => {
289288 baseConfig : { ...baseConfig , disableEmbeddingsValidation : false } as UserConfig ,
290289 request,
291290 } )
292- ) . toThrow (
293- "Cannot apply override for disableEmbeddingsValidation from false to true: Can only set to false"
294- ) ;
291+ ) . toThrow ( "Cannot apply override for disableEmbeddingsValidation: Can only set to false" ) ;
295292 } ) ;
296293 } ) ;
297294
0 commit comments