@@ -872,4 +872,72 @@ describe('given a mock platform for a BrowserClient', () => {
872872 // Verify that no fetch calls were made
873873 expect ( platform . requests . fetch . mock . calls . length ) . toBe ( 0 ) ;
874874 } ) ;
875+
876+ it ( 'uses FDv1 endpoints when dataSystem is not set' , async ( ) => {
877+ const client = makeClient (
878+ 'client-side-id' ,
879+ { key : 'user-key' , kind : 'user' } ,
880+ AutoEnvAttributes . Disabled ,
881+ { streaming : false , logger, diagnosticOptOut : true , sendEvents : false , fetchGoals : false } ,
882+ platform ,
883+ ) ;
884+
885+ await client . start ( ) ;
886+
887+ const fetchUrl = platform . requests . fetch . mock . calls [ 0 ] [ 0 ] ;
888+ expect ( fetchUrl ) . toContain ( '/sdk/evalx/' ) ;
889+ expect ( fetchUrl ) . not . toContain ( '/sdk/poll/eval' ) ;
890+ } ) ;
891+
892+ it ( 'uses FDv2 endpoints when dataSystem is set' , async ( ) => {
893+ const client = makeClient (
894+ 'client-side-id' ,
895+ { key : 'user-key' , kind : 'user' } ,
896+ AutoEnvAttributes . Disabled ,
897+ {
898+ streaming : false ,
899+ logger,
900+ diagnosticOptOut : true ,
901+ sendEvents : false ,
902+ fetchGoals : false ,
903+ // @ts -ignore dataSystem is @internal
904+ dataSystem : { } ,
905+ } ,
906+ platform ,
907+ ) ;
908+
909+ await client . start ( ) ;
910+
911+ const fetchUrl = platform . requests . fetch . mock . calls [ 0 ] [ 0 ] ;
912+ expect ( fetchUrl ) . toContain ( '/sdk/poll/eval/' ) ;
913+ } ) ;
914+
915+ it ( 'validates dataSystem options and applies browser defaults' , async ( ) => {
916+ const client = makeClient (
917+ 'client-side-id' ,
918+ { key : 'user-key' , kind : 'user' } ,
919+ AutoEnvAttributes . Disabled ,
920+ {
921+ streaming : false ,
922+ logger,
923+ diagnosticOptOut : true ,
924+ sendEvents : false ,
925+ fetchGoals : false ,
926+ // @ts -ignore dataSystem is @internal
927+ dataSystem : { initialConnectionMode : 'invalid-mode' } ,
928+ } ,
929+ platform ,
930+ ) ;
931+
932+ // Invalid mode should produce a warning
933+ expect ( logger . warn ) . toHaveBeenCalledWith (
934+ expect . stringContaining ( 'dataSystem.initialConnectionMode' ) ,
935+ ) ;
936+
937+ await client . start ( ) ;
938+
939+ // Should still use FDv2 — invalid sub-fields fall back to defaults, not disable FDv2
940+ const fetchUrl = platform . requests . fetch . mock . calls [ 0 ] [ 0 ] ;
941+ expect ( fetchUrl ) . toContain ( '/sdk/poll/eval/' ) ;
942+ } ) ;
875943} ) ;
0 commit comments