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');
74
66
assert.equal(client.__getStatus().isReady,false,'SDK in consumer mode is not operational inmediatelly');
75
-
assert.equal(typeofgetTreatmentResult.then,'function','GetTreatment calls should always return a promise on Consumer mode.');
76
-
assert.equal(awaitgetTreatmentResult,'control','Evaluations using pluggable storage should be control if initiated before SDK_READY.');
77
-
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.');
81
-
assert.true(awaittrackResult,'If the wrapper operation success to queue the event, the promise will resolve to true');
68
+
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'));
69
+
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'));
82
70
83
71
// Manager methods
84
-
assert.deepEqual(awaitnamesResult,[],'manager `names` method returns an empty list of split names if called before SDK_READY or wrapper operation fail');
85
-
assert.deepEqual(awaitsplitResult,null,'manager `split` method returns a null split view if called before SDK_READY or wrapper operation fail');
86
-
assert.deepEqual(awaitsplitsResult,[],'manager `splits` method returns an empty list of split views if called before SDK_READY or wrapper operation fail');
72
+
manager.names().then(namesResult=>assert.deepEqual(namesResult,[],'manager `names` method returns a promise that resolved to an empty list of split names if called before SDK_READY or wrapper operation fail'));
73
+
manager.split(expectedSplitName).then(splitResult=>assert.deepEqual(splitResult,null,'manager `split` method returns a promise that resolved to a null split view if called before SDK_READY or wrapper operation fail'));
74
+
manager.splits().then(splitsResult=>assert.deepEqual(splitsResult,[],'manager `splits` method returns a promise that resolved to an empty list of split views if called before SDK_READY or wrapper operation fail'));
87
75
88
76
/** Evaluation, track and manager methods on SDK_READY */
89
77
@@ -135,23 +123,13 @@ tape('Browser Consumer mode with pluggable storage', function (t) {
135
123
assert.true(awaitclient.track('user','test.event',18),'If the event was successfully queued the promise will resolve to true');
136
124
assert.false(awaitclient.track(),'If the event was NOT successfully queued the promise will resolve to false');
137
125
138
-
// Evaluations with flag sets
139
-
assert.deepEqual(awaitclient.getTreatmentsByFlagSet('set_a'),{with_set_a: 'on',with_sets_a_b: 'on'},'Evaluations with getTreatmentsByFlagSet should be correct.');
140
-
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.');
141
-
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.');
142
-
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.');
143
-
144
-
assert.deepEqual(awaitclient.getTreatmentsByFlagSet(),{},'Evaluations without flag set should be empty.');
145
-
assert.deepEqual(awaitclient.getTreatmentsByFlagSets([]),{},'Evaluations without flag sets should be empty.');
146
-
assert.deepEqual(awaitclient.getTreatmentsByFlagSets(['non_existent_set']),{},'Evaluations with non existent flag sets should be empty.');
147
-
148
126
// Manager methods
149
127
constsplitNames=awaitmanager.names();
150
-
assert.equal(splitNames.length,28,'manager `names` method returns the list of split names asynchronously');
128
+
assert.equal(splitNames.length,25,'manager `names` method returns the list of split names asynchronously');
151
129
assert.equal(splitNames.indexOf(expectedSplitName)>-1,true,'list of split names should contain expected splits');
152
130
assert.deepEqual(awaitmanager.split(expectedSplitName),expectedSplitView,'manager `split` method returns the split view of the given split name asynchronously');
153
131
constsplitViews=awaitmanager.splits();
154
-
assert.equal(splitViews.length,28,'manager `splits` method returns the list of split views asynchronously');
132
+
assert.equal(splitViews.length,25,'manager `splits` method returns the list of split views asynchronously');
155
133
assert.deepEqual(splitViews.find(splitView=>splitView.name===expectedSplitName),expectedSplitView,'manager `split` method returns the split view of the given split name asynchronously');
156
134
157
135
// New shared client created
@@ -173,7 +151,7 @@ tape('Browser Consumer mode with pluggable storage', function (t) {
assert.equal(trackedImpressions.length,TOTAL_RAW_IMPRESSIONS+TOTAL_RAW_IMPRESSIONS_IN_EVALUATIONS_WITH_FLAGSETS,'Tracked impressions should be present in the external storage');
154
+
assert.equal(trackedImpressions.length,TOTAL_RAW_IMPRESSIONS,'Tracked impressions should be present in the external storage');
177
155
assert.equal(trackedEvents.length,TOTAL_EVENTS,'Tracked events should be present in the external storage');
178
156
179
157
// Validate stored telemetry
@@ -186,7 +164,7 @@ tape('Browser Consumer mode with pluggable storage', function (t) {
186
164
187
165
// Assert impressionsListener
188
166
setTimeout(()=>{
189
-
assert.equal(impressions.length,TOTAL_RAW_IMPRESSIONS+TOTAL_RAW_IMPRESSIONS_IN_EVALUATIONS_WITH_FLAGSETS,'Each evaluation has its corresponding impression');
167
+
assert.equal(impressions.length,TOTAL_RAW_IMPRESSIONS,'Each evaluation has its corresponding impression');
190
168
assert.equal(impressions[0].impression.label,SDK_NOT_READY,'The first impression is control with label "sdk not ready"');
0 commit comments