@@ -141,6 +141,28 @@ describe("configOverrides", () => {
141141 } ) ;
142142
143143 describe ( "not-allowed behavior" , ( ) => {
144+ it ( "shoud have some not-allowed fields" , ( ) => {
145+ expect (
146+ Object . keys ( UserConfigSchema . shape ) . filter (
147+ ( key ) => getConfigMeta ( key as any ) ?. overrideBehavior === "not-allowed"
148+ )
149+ ) . toEqual ( [
150+ "apiBaseUrl" ,
151+ "apiClientId" ,
152+ "apiClientSecret" ,
153+ "logPath" ,
154+ "telemetry" ,
155+ "transport" ,
156+ "httpPort" ,
157+ "httpHost" ,
158+ "httpHeaders" ,
159+ "maxBytesPerQuery" ,
160+ "maxDocumentsPerQuery" ,
161+ "exportsPath" ,
162+ "voyageApiKey" ,
163+ ] ) ;
164+ } ) ;
165+
144166 it ( "should throw an error for not-allowed fields" , ( ) => {
145167 const request : RequestContext = {
146168 headers : {
@@ -157,7 +179,7 @@ describe("configOverrides", () => {
157179 } ) ;
158180 } ) ;
159181
160- describe ( "conditional overrides" , ( ) => {
182+ describe ( "custom overrides" , ( ) => {
161183 it ( "should have certain config keys to be conditionally overridden" , ( ) => {
162184 expect (
163185 Object . keys ( UserConfigSchema . shape )
@@ -180,7 +202,7 @@ describe("configOverrides", () => {
180202 const request : RequestContext = { headers : { "x-mongodb-mcp-read-only" : "false" } } ;
181203 expect ( ( ) =>
182204 applyConfigOverrides ( { baseConfig : { ...baseConfig , readOnly : true } as UserConfig , request } )
183- ) . toThrow ( "Config override validation failed for readOnly" ) ;
205+ ) . toThrow ( "Cannot apply override for readOnly from true to false: Cannot disable readOnly mode " ) ;
184206 } ) ;
185207
186208 it ( "should allow indexCheck override from false to true" , ( ) => {
@@ -196,7 +218,7 @@ describe("configOverrides", () => {
196218 const request : RequestContext = { headers : { "x-mongodb-mcp-index-check" : "false" } } ;
197219 expect ( ( ) =>
198220 applyConfigOverrides ( { baseConfig : { ...baseConfig , indexCheck : true } as UserConfig , request } )
199- ) . toThrow ( "Config override validation failed for indexCheck" ) ;
221+ ) . toThrow ( "Cannot apply override for indexCheck from true to false: Cannot disable indexCheck mode " ) ;
200222 } ) ;
201223
202224 it ( "should allow disableEmbeddingsValidation override from true to false" , ( ) => {
@@ -215,7 +237,9 @@ describe("configOverrides", () => {
215237 baseConfig : { ...baseConfig , disableEmbeddingsValidation : false } as UserConfig ,
216238 request,
217239 } )
218- ) . toThrow ( "Config override validation failed for disableEmbeddingsValidation" ) ;
240+ ) . toThrow (
241+ "Cannot apply override for disableEmbeddingsValidation from false to true: Cannot disable disableEmbeddingsValidation"
242+ ) ;
219243 } ) ;
220244 } ) ;
221245
0 commit comments