@@ -171,7 +171,43 @@ describe('Phase 4: Advanced Features', () => {
171171 const dynamicKeys = getDynamicKeys ( ParseServerOptionsSchema ) ;
172172 expect ( dynamicKeys ) . toContain ( 'publicServerURL' ) ;
173173 expect ( dynamicKeys ) . toContain ( 'masterKey' ) ;
174- // These are the keys that Config.transformConfiguration will handle
174+ } ) ;
175+
176+ it ( 'transformConfiguration renames function-valued dynamic keys with underscore prefix' , ( ) => {
177+ const Config = require ( '../../lib/Config' ) ;
178+ const dynamicFn = ( ) => 'https://example.com' ;
179+ const config = {
180+ appId : 'test-app' ,
181+ publicServerURL : dynamicFn ,
182+ masterKey : 'static-value' ,
183+ } ;
184+
185+ Config . transformConfiguration ( config ) ;
186+
187+ // Function-valued dynamic key should be renamed to _publicServerURL
188+ expect ( config . _publicServerURL ) . toBe ( dynamicFn ) ;
189+ expect ( config . publicServerURL ) . toBeUndefined ( ) ;
190+
191+ // Non-function dynamic key should remain unchanged
192+ expect ( config . masterKey ) . toBe ( 'static-value' ) ;
193+ expect ( config . _masterKey ) . toBeUndefined ( ) ;
194+
195+ // Non-dynamic key should remain unchanged
196+ expect ( config . appId ) . toBe ( 'test-app' ) ;
197+ } ) ;
198+
199+ it ( 'transformConfiguration leaves non-dynamic function values untouched' , ( ) => {
200+ const Config = require ( '../../lib/Config' ) ;
201+ const customFn = ( ) => 'value' ;
202+ const config = {
203+ appId : customFn ,
204+ } ;
205+
206+ Config . transformConfiguration ( config ) ;
207+
208+ // appId is not a dynamic key, so it should not be renamed even if it is a function
209+ expect ( config . appId ) . toBe ( customFn ) ;
210+ expect ( config . _appId ) . toBeUndefined ( ) ;
175211 } ) ;
176212 } ) ;
177213} ) ;
0 commit comments