77 waitForErrorRequest ,
88} from '../../../../../../utils/helpers' ;
99
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 } ) => {
1111 if ( shouldSkipFeatureFlagsTest ( ) ) {
1212 sentryTest . skip ( ) ;
1313 }
@@ -27,21 +27,10 @@ sentryTest('GrowthBook onError: basic eviction/update and mixed values', async (
2727 }
2828
2929 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
4534 } , FLAG_BUFFER_SIZE ) ;
4635
4736 const reqPromise = waitForErrorRequest ( page ) ;
@@ -50,12 +39,12 @@ sentryTest('GrowthBook onError: basic eviction/update and mixed values', async (
5039 const event = envelopeRequestParser ( req ) ;
5140
5241 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 ) ;
6150} ) ;
0 commit comments