File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
packages/optimizely-sdk/lib Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -903,6 +903,35 @@ describe('javascript-sdk (Browser)', function() {
903903
904904 sinon . assert . notCalled ( logger . error ) ;
905905 } ) ;
906+
907+ it ( 'should send odp client_initialized on client instantiation' , async ( ) => {
908+ const odpConfig = new OdpConfig ( ) ;
909+ const apiManager = new BrowserOdpEventApiManager ( mockRequestHandler , logger ) ;
910+ apiManager . sendEvents = sinon . spy ( ) ;
911+ const eventManager = new BrowserOdpEventManager ( {
912+ odpConfig,
913+ apiManager,
914+ logger,
915+ } ) ;
916+ const datafile = testData . getOdpIntegratedConfigWithSegments ( ) ;
917+ const client = optimizelyFactory . createInstance ( {
918+ datafile,
919+ errorHandler : fakeErrorHandler ,
920+ eventDispatcher : fakeEventDispatcher ,
921+ eventBatchSize : null ,
922+ logger,
923+ odpOptions : {
924+ odpConfig,
925+ eventManager,
926+ } ,
927+ } ) ;
928+
929+ const readyData = await client . onReady ( ) ;
930+ assert . equal ( readyData . success , true ) ;
931+ assert . isUndefined ( readyData . reason ) ;
932+
933+ setTimeout ( ( ) => sinon . assert . callCount ( apiManager . sendEvents , 1 ) , 100 ) ;
934+ } ) ;
906935 } ) ;
907936 } ) ;
908937} ) ;
You can’t perform that action at this time.
0 commit comments