7
7
waitForErrorRequest ,
8
8
} from '../../../../../../utils/helpers' ;
9
9
10
- sentryTest ( 'GrowthBook onError: basic eviction/update and mixed values ' , async ( { getLocalTestUrl, page } ) => {
10
+ sentryTest ( 'GrowthBook onError: basic eviction/update and no async tasks ' , async ( { getLocalTestUrl, page } ) => {
11
11
if ( shouldSkipFeatureFlagsTest ( ) ) {
12
12
sentryTest . skip ( ) ;
13
13
}
@@ -27,21 +27,10 @@ sentryTest('GrowthBook onError: basic eviction/update and mixed values', async (
27
27
}
28
28
29
29
gb . __setOn ( `feat${ bufferSize + 1 } ` , true ) ;
30
- gb . isOn ( `feat${ bufferSize + 1 } ` ) ;
31
- gb . isOn ( 'feat3' ) ;
32
-
33
- // Add typed flags at the end so they are not evicted
34
- gb . __setOn ( 'onTrue' , true ) ;
35
- gb . __setOn ( 'onFalse' , false ) ;
36
- gb . __setFeatureValue ( 'strVal' , 'hello' ) ;
37
- gb . __setFeatureValue ( 'numVal' , 42 ) ;
38
- gb . __setFeatureValue ( 'objVal' , { a : 1 , b : 'c' } ) ;
39
-
40
- gb . isOn ( 'onTrue' ) ;
41
- gb . isOn ( 'onFalse' ) ;
42
- gb . getFeatureValue ( 'strVal' , '' ) ;
43
- gb . getFeatureValue ( 'numVal' , 0 ) ;
44
- gb . getFeatureValue ( 'objVal' , { } ) ;
30
+ gb . isOn ( `feat${ bufferSize + 1 } ` ) ; // eviction
31
+
32
+ gb . __setOn ( 'feat3' , true ) ;
33
+ gb . isOn ( 'feat3' ) ; // update
45
34
} , FLAG_BUFFER_SIZE ) ;
46
35
47
36
const reqPromise = waitForErrorRequest ( page ) ;
@@ -50,12 +39,12 @@ sentryTest('GrowthBook onError: basic eviction/update and mixed values', async (
50
39
const event = envelopeRequestParser ( req ) ;
51
40
52
41
const values = event . contexts ?. flags ?. values || [ ] ;
53
- // Only assert presence when buffer wasn't fully overwritten by filler flags
54
- // just check capture of some typed values.
55
- expect ( values ) . toEqual (
56
- expect . arrayContaining ( [
57
- { flag : 'onTrue' , result : true } ,
58
- { flag : 'onFalse ' , result : false } ,
59
- ] ) ,
60
- ) ;
42
+ const expectedFlags = [ { flag : 'feat2' , result : false } ] ;
43
+ for ( let i = 4 ; i <= FLAG_BUFFER_SIZE ; i ++ ) {
44
+ expectedFlags . push ( { flag : `feat ${ i } ` , result : false } ) ;
45
+ }
46
+ expectedFlags . push ( { flag : `feat ${ FLAG_BUFFER_SIZE + 1 } ` , result : true } ) ;
47
+ expectedFlags . push ( { flag : 'feat3 ' , result : true } ) ;
48
+
49
+ expect ( values ) . toEqual ( expectedFlags ) ;
61
50
} ) ;
0 commit comments