@@ -71,7 +71,6 @@ describe('hooks', () => {
71
71
let notificationListenerCallbacks : Array < ( ) => void > ;
72
72
let optimizelyMock : ReactSDKClient ;
73
73
let readySuccess : boolean ;
74
- // let reason: NotReadyReason;
75
74
let userUpdateCallbacks : Array < ( ) => void > ;
76
75
let UseExperimentLoggingComponent : React . FunctionComponent < any > ;
77
76
let UseFeatureLoggingComponent : React . FunctionComponent < any > ;
@@ -214,7 +213,7 @@ describe('hooks', () => {
214
213
215
214
it ( 'should respect the timeout option passed' , async ( ) => {
216
215
activateMock . mockReturnValue ( null ) ;
217
- mockDelay = 100 ;
216
+ mockDelay = 20 ;
218
217
readySuccess = false ;
219
218
220
219
render (
@@ -255,8 +254,6 @@ describe('hooks', () => {
255
254
</ OptimizelyProvider >
256
255
) ;
257
256
258
- // TODO - Wrap this with async act() once we upgrade to React 16.9
259
- // See https://github.com/facebook/react/issues/15379
260
257
await waitFor ( ( ) => expect ( screen . getByTestId ( 'result' ) ) . toHaveTextContent ( 'null|true|false' ) ) ;
261
258
262
259
activateMock . mockReturnValue ( '12345' ) ;
@@ -276,8 +273,6 @@ describe('hooks', () => {
276
273
</ OptimizelyProvider >
277
274
) ;
278
275
279
- // // TODO - Wrap this with async act() once we upgrade to React 16.9
280
- // // See https://github.com/facebook/react/issues/15379
281
276
await waitFor ( ( ) => expect ( screen . getByTestId ( 'result' ) ) . toHaveTextContent ( 'null|true|false' ) ) ;
282
277
283
278
activateMock . mockReturnValue ( '12345' ) ;
@@ -455,7 +450,7 @@ describe('hooks', () => {
455
450
} ) ;
456
451
457
452
it ( 'should respect the timeout option passed' , async ( ) => {
458
- mockDelay = 100 ;
453
+ mockDelay = 20 ;
459
454
isFeatureEnabledMock . mockReturnValue ( false ) ;
460
455
featureVariables = { } ;
461
456
readySuccess = false ;
@@ -502,8 +497,6 @@ describe('hooks', () => {
502
497
</ OptimizelyProvider >
503
498
) ;
504
499
505
- // TODO - Wrap this with async act() once we upgrade to React 16.9
506
- // See https://github.com/facebook/react/issues/15379
507
500
await waitFor ( ( ) => expect ( screen . getByTestId ( 'result' ) ) . toHaveTextContent ( 'false|{}|true|false' ) ) ;
508
501
509
502
isFeatureEnabledMock . mockReturnValue ( true ) ;
@@ -525,8 +518,6 @@ describe('hooks', () => {
525
518
</ OptimizelyProvider >
526
519
) ;
527
520
528
- // TODO - Wrap this with async act() once we upgrade to React 16.9
529
- // See https://github.com/facebook/react/issues/15379
530
521
await waitFor ( ( ) => expect ( screen . getByTestId ( 'result' ) ) . toHaveTextContent ( 'false|{}|true|false' ) ) ;
531
522
532
523
isFeatureEnabledMock . mockReturnValue ( true ) ;
@@ -535,7 +526,7 @@ describe('hooks', () => {
535
526
act ( ( ) => {
536
527
userUpdateCallbacks . forEach ( ( fn ) => fn ( ) ) ;
537
528
} ) ;
538
- // component.update();
529
+
539
530
await waitFor ( ( ) => expect ( screen . getByTestId ( 'result' ) ) . toHaveTextContent ( 'false|{}|true|false' ) ) ;
540
531
} ) ;
541
532
@@ -697,7 +688,7 @@ describe('hooks', () => {
697
688
it ( 'should respect the timeout option passed' , async ( ) => {
698
689
decideMock . mockReturnValue ( { ...defaultDecision } ) ;
699
690
readySuccess = false ;
700
- mockDelay = 100 ;
691
+ mockDelay = 20 ;
701
692
702
693
render (
703
694
< OptimizelyProvider optimizely = { optimizelyMock } >
@@ -741,8 +732,6 @@ describe('hooks', () => {
741
732
</ OptimizelyProvider >
742
733
) ;
743
734
744
- // TODO - Wrap this with async act() once we upgrade to React 16.9
745
- // See https://github.com/facebook/react/issues/15379
746
735
await waitFor ( ( ) => expect ( screen . getByTestId ( 'result' ) ) . toHaveTextContent ( 'false|{}|true|false' ) ) ;
747
736
748
737
decideMock . mockReturnValue ( {
@@ -765,8 +754,6 @@ describe('hooks', () => {
765
754
</ OptimizelyProvider >
766
755
) ;
767
756
768
- // TODO - Wrap this with async act() once we upgrade to React 16.9
769
- // See https://github.com/facebook/react/issues/15379
770
757
await waitFor ( ( ) => expect ( screen . getByTestId ( 'result' ) ) . toHaveTextContent ( 'false|{}|true|false' ) ) ;
771
758
772
759
decideMock . mockReturnValue ( {
@@ -789,7 +776,7 @@ describe('hooks', () => {
789
776
< UseDecisionLoggingComponent />
790
777
</ OptimizelyProvider >
791
778
) ;
792
- // component.update();
779
+
793
780
expect ( mockLog ) . toHaveBeenCalledTimes ( 1 ) ;
794
781
expect ( mockLog ) . toHaveBeenCalledWith ( false ) ;
795
782
} ) ;
0 commit comments