You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
assert.test('FallbackTreatment / Impressions correctness with fallback when client is not ready',asynct=>{
115
122
116
-
constconfig=Object.assign({},baseConfig);
117
-
config.urls={
118
-
events: 'https://events.fallbacktreatment/api'
123
+
assert.test('FallbackTreatment / override applies only when original is control - inLocalStorage',asynct=>{
124
+
125
+
constconfig={
126
+
...configInLocalStorage,
127
+
fallbackTreatments: {
128
+
global: 'OFF_FALLBACK'
129
+
}
119
130
};
120
-
config.fallbackTreatments={
121
-
byFlag: {
122
-
'any_flag': 'OFF_FALLBACK'
131
+
constsplitio=SplitFactory(config);
132
+
constclient=splitio.client();
133
+
134
+
awaitclient.whenReady();
135
+
136
+
t.equal(client.getTreatment('user_account_in_whitelist'),'off','The evaluation will return the treatment defined in the flag if it exists');
137
+
t.equal(client.getTreatment('non_existent_flag'),'OFF_FALLBACK','The evaluation will return `OFF_FALLBACK` if the flag does not exist and no fallbackTreatment is defined');
138
+
139
+
awaitclient.destroy();
140
+
t.end();
141
+
142
+
});
143
+
144
+
assert.test('FallbackTreatment / Impressions correctness with fallback when client is not ready',asynct=>{
t.deepEqual(client.getTreatmentWithConfig('my_flag'),{treatment: 'ON_FALLBACK',config: '{"flag": true}'},'The evaluation will propagate the config along with the treatment from the fallbackTreatment');
227
+
t.deepEqual(client.getTreatmentWithConfig('non_existent_flag'),{treatment: 'OFF_FALLBACK',config: '{"global": true}'},'The evaluation will propagate the config along with the treatment from the fallbackTreatment');
228
+
229
+
awaitclient.destroy();
230
+
t.end();
231
+
232
+
});
233
+
234
+
assert.test('FallbackTreatment / Evaluations non existing flags with fallback do not generate impressions',asynct=>{
0 commit comments