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.equal(client.__getStatus().isReadyFromCache,false,'SDK in consumer mode is not operational inmediatelly');
101
92
assert.equal(client.__getStatus().isReady,false,'SDK in consumer mode is not operational inmediatelly');
102
-
assert.equal(typeofgetTreatmentResult.then,'function','GetTreatment calls should always return a promise on Consumer mode.');
103
-
assert.equal(awaitgetTreatmentResult,'control','Evaluations using pluggable storage should be control if initiated before SDK_READY.');
104
-
assert.deepEqual(awaitgetTreatmentsWithConfigByFlagSetsResult,{},'Flag sets evaluations using pluggable storage should be empty if initiated before SDK_READY.');
assert.equal(typeoftrackResult.then,'function','Track calls should always return a promise on Consumer mode.');
108
-
assert.true(awaittrackResult,'If the wrapper operation success to queue the event, the promise will resolve to true');
94
+
client.getTreatment('UT_IN_SEGMENT').then(treatment=>assert.equal(treatment,'control','Evaluations using pluggable storage returns a promise that resolves to control if initiated before SDK_READY'));
95
+
otherClient.track('user','test.event',18).then(result=>assert.true(result,'Track calls returns a promise on consumer mode, that resolves to true if the wrapper push operation success to queue the event'));
109
96
110
97
// Manager methods
111
-
assert.deepEqual(awaitnamesResult,[],'manager `names` method returns an empty list of split names if called before SDK_READY or wrapper operation fail');
112
-
assert.deepEqual(awaitsplitResult,null,'manager `split` method returns a null split view if called before SDK_READY or wrapper operation fail');
113
-
assert.deepEqual(awaitsplitsResult,[],'manager `splits` method returns an empty list of split views if called before SDK_READY or wrapper operation fail');
98
+
manager.names().then(namesResult=>assert.deepEqual(namesResult,[],'manager `names` method returns an empty list of split names if called before SDK_READY or wrapper operation fail'));
99
+
manager.split(expectedSplitName).then(splitResult=>assert.deepEqual(splitResult,null,'manager `split` method returns a null split view if called before SDK_READY or wrapper operation fail'));
100
+
manager.splits().then(splitsResult=>assert.deepEqual(splitsResult,[],'manager `splits` method returns an empty list of split views if called before SDK_READY or wrapper operation fail'));
114
101
115
102
/** Evaluation, track and manager methods on SDK_READY */
116
103
@@ -161,23 +148,13 @@ tape('Browser Consumer Partial mode with pluggable storage', function (t) {
161
148
assert.true(awaitclient.track('user','test.event',18),'If the event was successfully queued the promise will resolve to true');
162
149
assert.false(awaitclient.track(),'If the event was NOT successfully queued the promise will resolve to false');
163
150
164
-
// Evaluations with flag sets
165
-
assert.deepEqual(awaitclient.getTreatmentsByFlagSet('set_a'),{with_set_a: 'on',with_sets_a_b: 'on'},'Evaluations with getTreatmentsByFlagSet should be correct.');
166
-
assert.deepEqual(awaitclient.getTreatmentsByFlagSets(['set_a','set_b']),{with_set_a: 'on',with_set_b: 'on',with_sets_a_b: 'on'},'Evaluations with getTreatmentsByFlagSets should be correct.');
167
-
assert.deepEqual(awaitclient.getTreatmentsWithConfigByFlagSet('set_b'),{with_set_b: {treatment: 'on',config: '{}'},with_sets_a_b: {treatment: 'on',config: null}},'Evaluations with getTreatmentsWithConfigByFlagSet should be correct.');
168
-
assert.deepEqual(awaitclient.getTreatmentsWithConfigByFlagSets(['set_a','set_b']),{with_set_a: {treatment: 'on',config: null},with_set_b: {treatment: 'on',config: '{}'},with_sets_a_b: {treatment: 'on',config: null}},'Evaluations with getTreatmentsWithConfigByFlagSets should be correct.');
169
-
170
-
assert.deepEqual(awaitclient.getTreatmentsByFlagSet(),{},'Evaluations without flag set should be empty.');
171
-
assert.deepEqual(awaitclient.getTreatmentsByFlagSets([]),{},'Evaluations without flag sets should be empty.');
172
-
assert.deepEqual(awaitclient.getTreatmentsByFlagSets(['non_existent_set']),{},'Evaluations with non existent flag sets should be empty.');
173
-
174
151
// Manager methods
175
152
constsplitNames=awaitmanager.names();
176
-
assert.equal(splitNames.length,28,'manager `names` method returns the list of split names asynchronously');
153
+
assert.equal(splitNames.length,25,'manager `names` method returns the list of split names asynchronously');
177
154
assert.equal(splitNames.indexOf(expectedSplitName)>-1,true,'list of split names should contain expected splits');
178
155
assert.deepEqual(awaitmanager.split(expectedSplitName),expectedSplitView,'manager `split` method returns the split view of the given split name asynchronously');
179
156
constsplitViews=awaitmanager.splits();
180
-
assert.equal(splitViews.length,28,'manager `splits` method returns the list of split views asynchronously');
157
+
assert.equal(splitViews.length,25,'manager `splits` method returns the list of split views asynchronously');
181
158
assert.deepEqual(splitViews.find(splitView=>splitView.name===expectedSplitName),expectedSplitView,'manager `split` method returns the split view of the given split name asynchronously');
182
159
183
160
// New shared client created
@@ -201,7 +178,7 @@ tape('Browser Consumer Partial mode with pluggable storage', function (t) {
201
178
202
179
// Assert impressionsListener
203
180
setTimeout(()=>{
204
-
assert.equal(impressions.length,TOTAL_RAW_IMPRESSIONS+TOTAL_RAW_IMPRESSIONS_IN_EVALUATIONS_WITH_FLAGSETS,'Each evaluation has its corresponding impression');
181
+
assert.equal(impressions.length,TOTAL_RAW_IMPRESSIONS,'Each evaluation has its corresponding impression');
205
182
assert.equal(impressions[0].impression.label,SDK_NOT_READY,'The first impression is control with label "sdk not ready"');
0 commit comments