@@ -27,7 +27,7 @@ const config = {
2727 segmentsRefreshRate : 1 ,
2828 impressionsRefreshRate : 3000 ,
2929 impressionsQueueSize : 3 , // flush impressions when 3 are queued
30- uniqueKeysCacheSize : 7 // flush impressions when 3 are queued
30+ uniqueKeysCacheSize : 7 // flush impressions when 7 are queued
3131 } ,
3232 urls : baseUrls ,
3333 startup : {
@@ -52,29 +52,25 @@ export default async function (key, fetchMock, assert) {
5252 fetchMock . postOnce ( url ( settings , '/v1/keys/ss' ) , ( url , opts ) => {
5353 const data = JSON . parse ( opts . body ) ;
5454
55- assert . equal ( data . keys . length , 3 , 'We performed evaluations for three split, so we should have 3 item total.' ) ;
56-
57- function validateImpressionData ( output , expected ) {
58- assert . equal ( output . f , expected . featureName , 'Present impressions should have the correct featureName.' ) ;
59- assert . deepEqual ( output . ks , expected . keys , 'Present impressions should have the correct key list.' ) ;
60- }
55+ assert . deepEqual ( data , {
56+ keys : [
57+ {
58+ f : 'split_with_config' ,
59+ ks :[ 'emma@split.io' , 'emi@split.io' ]
60+ } ,
61+ {
62+ f : 'always_off' ,
63+ ks :[ 'emma@split.io' , 'emi@split.io' ]
64+ } ,
65+ {
66+ f : 'always_on' ,
67+ ks :[ 'emma@split.io' , 'emi@split.io' , 'nico@split.io' ]
68+ }
69+ ]
70+ } , 'We performed evaluations for three split, so we should have 3 item total.' ) ;
6171
6272 client . destroy ( ) . then ( ( ) => {
63- validateImpressionData ( data . keys [ 0 ] , {
64- featureName : 'split_with_config' ,
65- keys :[ 'emma@split.io' , 'emi@split.io' ]
66- } ) ;
67- validateImpressionData ( data . keys [ 1 ] , {
68- featureName : 'always_off' ,
69- keys :[ 'emma@split.io' , 'emi@split.io' ]
70- } ) ;
71- validateImpressionData ( data . keys [ 2 ] , {
72- featureName : 'always_on' ,
73- keys :[ 'emma@split.io' , 'emi@split.io' , 'nico@split.io' ]
74- } ) ;
75-
7673 assert . end ( ) ;
77-
7874 } ) ;
7975
8076 return 200 ;
@@ -89,8 +85,10 @@ export default async function (key, fetchMock, assert) {
8985 client . getTreatment ( 'emma@split.io' , 'always_on' ) ;
9086 client . getTreatment ( 'emi@split.io' , 'always_on' ) ;
9187 client . getTreatment ( 'nico@split.io' , 'always_on' ) ;
88+ client . getTreatment ( 'emma@split.io' , 'always_off' ) ;
9289 client . getTreatment ( 'emma@split.io' , 'always_on' ) ;
9390 client . getTreatment ( 'emi@split.io' , 'always_off' ) ;
91+ client . getTreatment ( 'nico@split.io' , 'always_on' ) ;
9492 client . getTreatment ( 'emi@split.io' , 'split_with_config' ) ;
9593 client . getTreatment ( 'emma@split.io' , 'split_with_config' ) ;
9694
0 commit comments