@@ -6,6 +6,7 @@ import DefaultEventDispatcher, {
66} from './default-event-dispatcher' ;
77import { Event } from './event-dispatcher' ;
88import NetworkStatusListener from './network-status-listener' ;
9+ import NoOpEventDispatcher from './no-op-event-dispatcher' ;
910
1011global . fetch = jest . fn ( ) ;
1112
@@ -201,14 +202,13 @@ describe('DefaultEventDispatcher', () => {
201202 } ) ;
202203
203204 describe ( 'newDefaultEventDispatcher' , ( ) => {
204- it ( 'should throw if SDK key is invalid' , ( ) => {
205- expect ( ( ) => {
206- newDefaultEventDispatcher (
207- new ArrayBackedNamedEventQueue ( 'test-queue' ) ,
208- mockNetworkStatusListener ,
209- 'invalid-sdk-key' ,
210- ) ;
211- } ) . toThrow ( 'Unable to parse Event ingestion URL from SDK key' ) ;
205+ it ( 'should fallback to no-op dispatcher if SDK key is invalid' , ( ) => {
206+ const eventDispatcher = newDefaultEventDispatcher (
207+ new ArrayBackedNamedEventQueue ( 'test-queue' ) ,
208+ mockNetworkStatusListener ,
209+ 'invalid-sdk-key' ,
210+ ) ;
211+ expect ( eventDispatcher ) . toBeInstanceOf ( NoOpEventDispatcher ) ;
212212 } ) ;
213213
214214 it ( 'should create a new DefaultEventDispatcher with the provided configuration' , ( ) => {
0 commit comments