@@ -109,6 +109,13 @@ describes.realWin('installBasicRuntime', (env) => {
109109 expect ( getBasicRuntime ( ) ) . to . equal ( runtime1 ) ;
110110 } ) ;
111111
112+ it ( 'should expose getDiagnostics on global SWG_BASIC' , ( ) => {
113+ installBasicRuntime ( win ) ;
114+ expect ( win . SWG_BASIC . getDiagnostics ) . to . be . a ( 'function' ) ;
115+ const diagnostics = win . SWG_BASIC . getDiagnostics ( ) ;
116+ expect ( diagnostics ) . to . have . property ( 'isGisReady' ) ;
117+ } ) ;
118+
112119 it ( 'handles recursive calls after installation' , async ( ) => {
113120 installBasicRuntime ( win ) ;
114121 let progress = '' ;
@@ -483,9 +490,54 @@ describes.realWin('BasicRuntime', (env) => {
483490 } ) ;
484491
485492 const configuredRuntime = await basicRuntime . configured_ ( true ) ;
486-
487493 expect ( configuredRuntime . gisInteropManager ( ) ) . to . not . exist ;
488494 } ) ;
495+
496+ it ( 'should return getDiagnostics().isGisReady true when all params are present' , ( ) => {
497+ basicRuntime . init ( {
498+ ...DEFAULT_INIT_PARAMS ,
499+ gisInterop : true ,
500+ clientOptions : {
501+ clientId : 'test-client-id' ,
502+ onGisOptIn : ( ) => { } ,
503+ } ,
504+ } ) ;
505+ expect ( basicRuntime . getDiagnostics ( ) . isGisReady ) . to . be . true ;
506+ } ) ;
507+
508+ it ( 'should return getDiagnostics().isGisReady false when gisInterop is false' , ( ) => {
509+ basicRuntime . init ( {
510+ ...DEFAULT_INIT_PARAMS ,
511+ gisInterop : false ,
512+ clientOptions : {
513+ clientId : 'test-client-id' ,
514+ onGisOptIn : ( ) => { } ,
515+ } ,
516+ } ) ;
517+ expect ( basicRuntime . getDiagnostics ( ) . isGisReady ) . to . be . false ;
518+ } ) ;
519+
520+ it ( 'should return getDiagnostics().isGisReady false when clientId is missing' , ( ) => {
521+ basicRuntime . init ( {
522+ ...DEFAULT_INIT_PARAMS ,
523+ gisInterop : true ,
524+ clientOptions : {
525+ onGisOptIn : ( ) => { } ,
526+ } ,
527+ } ) ;
528+ expect ( basicRuntime . getDiagnostics ( ) . isGisReady ) . to . be . false ;
529+ } ) ;
530+
531+ it ( 'should return getDiagnostics().isGisReady false when onGisOptIn is missing' , ( ) => {
532+ basicRuntime . init ( {
533+ ...DEFAULT_INIT_PARAMS ,
534+ gisInterop : true ,
535+ clientOptions : {
536+ clientId : 'test-client-id' ,
537+ } ,
538+ } ) ;
539+ expect ( basicRuntime . getDiagnostics ( ) . isGisReady ) . to . be . false ;
540+ } ) ;
489541 } ) ;
490542
491543 describe ( 'configured' , ( ) => {
@@ -815,6 +867,51 @@ describes.realWin('BasicRuntime', (env) => {
815867
816868 await basicRuntime . setupInlineCta ( ) ;
817869 } ) ;
870+
871+ it ( 'should return getDiagnostics().isGisReady true when all params are present in ConfiguredBasicRuntime' , ( ) => {
872+ sandbox
873+ . stub ( configuredBasicRuntime , 'config' )
874+ . returns ( { gisInterop : true } ) ;
875+ clientConfigManagerMock
876+ . expects ( 'getClientId' )
877+ . returns ( 'test-client-id' )
878+ . once ( ) ;
879+ clientConfigManagerMock
880+ . expects ( 'getOnGisOptIn' )
881+ . returns ( ( ) => { } )
882+ . once ( ) ;
883+ expect ( configuredBasicRuntime . getDiagnostics ( ) . isGisReady ) . to . be . true ;
884+ } ) ;
885+
886+ it ( 'should return getDiagnostics().isGisReady false when gisInterop is false in ConfiguredBasicRuntime' , ( ) => {
887+ sandbox
888+ . stub ( configuredBasicRuntime , 'config' )
889+ . returns ( { gisInterop : false } ) ;
890+ expect ( configuredBasicRuntime . getDiagnostics ( ) . isGisReady ) . to . be . false ;
891+ } ) ;
892+
893+ it ( 'should return getDiagnostics().isGisReady false when clientId is missing in ConfiguredBasicRuntime' , ( ) => {
894+ sandbox
895+ . stub ( configuredBasicRuntime , 'config' )
896+ . returns ( { gisInterop : true } ) ;
897+ clientConfigManagerMock . expects ( 'getClientId' ) . returns ( undefined ) . once ( ) ;
898+ expect ( configuredBasicRuntime . getDiagnostics ( ) . isGisReady ) . to . be . false ;
899+ } ) ;
900+
901+ it ( 'should return getDiagnostics().isGisReady false when onGisOptIn is missing in ConfiguredBasicRuntime' , ( ) => {
902+ sandbox
903+ . stub ( configuredBasicRuntime , 'config' )
904+ . returns ( { gisInterop : true } ) ;
905+ clientConfigManagerMock
906+ . expects ( 'getClientId' )
907+ . returns ( 'test-client-id' )
908+ . once ( ) ;
909+ clientConfigManagerMock
910+ . expects ( 'getOnGisOptIn' )
911+ . returns ( undefined )
912+ . once ( ) ;
913+ expect ( configuredBasicRuntime . getDiagnostics ( ) . isGisReady ) . to . be . false ;
914+ } ) ;
818915 } ) ;
819916} ) ;
820917
0 commit comments