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
t.equal(localStorage.getItem('readyFromCache_3.SPLITIO.split.always_on'),alwaysOnSplitInverted,'splits must not be cleaned from cache');
259
+
t.equal(localStorage.getItem('readyFromCache_3.SPLITIO.split.always_on'),alwaysOnSplitInverted,'feature flags must not be cleaned from cache');
260
260
returnnewPromise(res=>{setTimeout(()=>res({status: 200,body: { ...splitChangesMock1,since: 25},headers: {}}),200);});// 400ms is how long it'll take to reply with Splits, no SDK_READY should be emitted before that.
@@ -461,6 +461,8 @@ export default function (fetchMock, assert) {
461
461
t.equal(localStorage.getItem('some_user_item'),'user_item','user items at localStorage must not be changed');
462
462
t.equal(localStorage.getItem('readyFromCache_4.SPLITIO.splits.till'),'1457552620999','splits.till must correspond to the till of the last successfully fetched Splits');
463
463
t.true(nearlyEqual(parseInt(localStorage.getItem('readyFromCache_4.SPLITIO.splits.lastUpdated')),Date.now()-1000/* 1000 ms between last Split and MySegments fetch */),'lastUpdated must correspond to the timestamp of the last successfully fetched Splits');
464
+
465
+
t.end();
464
466
});
465
467
});
466
468
t.true(Date.now()-startTime>=1000,'It should emit SDK_READY after syncing with the cloud.');
@@ -478,7 +480,7 @@ export default function (fetchMock, assert) {
478
480
479
481
/** Fetch specific splits **/
480
482
481
-
assert.test(t=>{// Testing when we start with cached data but without storage hash (JS SDK version 10.24.0 and below), and a valid split filter config
483
+
assert.test(t=>{// Testing when we start with cached data but without storage hash (JS SDK <=v10.24.0 and Browser SDK <=v0.12.0), and a valid split filter config
482
484
consttestUrls={
483
485
sdk: 'https://sdk.baseurl/readyFromCache_5',
484
486
events: 'https://events.baseurl/readyFromCache_5'
@@ -512,7 +514,7 @@ export default function (fetchMock, assert) {
t.fail('It should not emit SDK_READY_FROM_CACHE because localstorage is cleaned and there isn\'t cached data');
517
+
t.fail('It should not emit SDK_READY_FROM_CACHE because localStorage is cleaned and there isn\'t cached feature flags');
516
518
t.end();
517
519
});
518
520
@@ -522,8 +524,8 @@ export default function (fetchMock, assert) {
522
524
client.destroy().then(()=>{
523
525
t.equal(localStorage.getItem('some_user_item'),'user_item','user items at localStorage must not be changed');
524
526
t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.splits.till'),'1457552620999','splits.till must correspond to the till of the last successfully fetched Splits');
525
-
t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.split.p1__split'),JSON.stringify(splitDeclarations.p1__split),'split declarations must be cached');
526
-
t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'split declarations must be cached');
527
+
t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.split.p1__split'),JSON.stringify(splitDeclarations.p1__split),'feature flag declarations must be cached');
528
+
t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'feature flag declarations must be cached');
527
529
t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.hash'),expectedHashWithFilter,'Storage hash must correspond to the one for the SDK key and feature flag filter query');
@@ -567,8 +569,8 @@ export default function (fetchMock, assert) {
567
569
568
570
client.destroy().then(()=>{
569
571
t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.splits.till'),'1457552620999','splits.till must correspond to the till of the last successfully fetched Splits');
570
-
t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.split.p1__split'),JSON.stringify(splitDeclarations.p1__split),'split declarations must be cached');
571
-
t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'split declarations must be cached');
572
+
t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.split.p1__split'),JSON.stringify(splitDeclarations.p1__split),'feature flag declarations must be cached');
573
+
t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'feature flag declarations must be cached');
572
574
t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.hash'),expectedHashWithFilter,'Storage hash must correspond to the split filter query and SDK key');
573
575
t.end();
574
576
});
@@ -618,8 +620,8 @@ export default function (fetchMock, assert) {
618
620
client.destroy().then(()=>{
619
621
t.equal(localStorage.getItem('some_user_item'),'user_item','user items at localStorage must not be changed');
620
622
t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.splits.till'),'1457552620999','splits.till must correspond to the till of the last successfully fetched Splits');
621
-
t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.split.p1__split'),JSON.stringify(splitDeclarations.p1__split),'split declarations must be cached');
622
-
t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'split declarations must be cached');
623
+
t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.split.p1__split'),JSON.stringify(splitDeclarations.p1__split),'feature flag declarations must be cached');
624
+
t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'feature flag declarations must be cached');
623
625
t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.hash'),expectedHash,'Storage hash must correspond to the split filter query and SDK key');
624
626
t.end();
625
627
});
@@ -671,8 +673,8 @@ export default function (fetchMock, assert) {
671
673
client.destroy().then(()=>{
672
674
t.equal(localStorage.getItem('some_user_item'),'user_item','user items at localStorage must not be changed');
673
675
t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.splits.till'),'1457552620999','splits.till must correspond to the till of the last successfully fetched Splits');
674
-
t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.split.p1__split'),JSON.stringify(splitDeclarations.p1__split),'split declarations must be cached');
675
-
t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'split declarations must be cached');
676
+
t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.split.p1__split'),JSON.stringify(splitDeclarations.p1__split),'feature flag declarations must be cached');
677
+
t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'feature flag declarations must be cached');
676
678
t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.hash'),expectedHash,'Storage hash must correspond to the split filter query and SDK key');
677
679
t.end();
678
680
});
@@ -724,7 +726,7 @@ export default function (fetchMock, assert) {
t.fail('It should not emit SDK_READY_FROM_CACHE because all splits were removed from cache since the filter query changed.');
729
+
t.fail('It should not emit SDK_READY_FROM_CACHE because all feature flags were removed from cache since the filter query changed.');
728
730
t.end();
729
731
});
730
732
@@ -734,9 +736,9 @@ export default function (fetchMock, assert) {
734
736
client.destroy().then(()=>{
735
737
t.equal(localStorage.getItem('some_user_item'),'user_item','user items at localStorage must not be changed');
736
738
t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.splits.till'),'1457552620999','splits.till must correspond to the till of the last successfully fetched Splits');
737
-
t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p1__split'),JSON.stringify(splitDeclarations.p1__split),'split declarations must be cached');
738
-
t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'split declarations must be cached');
739
-
t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p3__split'),JSON.stringify(splitDeclarations.p3__split),'split declarations must be cached');
739
+
t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p1__split'),JSON.stringify(splitDeclarations.p1__split),'feature flag declarations must be cached');
740
+
t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'feature flag declarations must be cached');
741
+
t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p3__split'),JSON.stringify(splitDeclarations.p3__split),'feature flag declarations must be cached');
740
742
t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.hash'),expectedHashNullFilter,'Storage hash must correspond to the split filter query and SDK key');
741
743
t.end();
742
744
});
@@ -784,9 +786,9 @@ export default function (fetchMock, assert) {
784
786
client.destroy().then(()=>{
785
787
t.equal(localStorage.getItem('some_user_item'),'user_item','user items at localStorage must not be changed');
786
788
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.splits.till'),'1457552620999','splits.till must correspond to the till of the last successfully fetched Splits');
787
-
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'split declarations must be cached');
788
-
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.split.p3__split'),JSON.stringify(splitDeclarations.p3__split),'split declarations must be cached');
789
-
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.hash'),getStorageHash({ ...baseConfig,sync: {__splitFiltersValidation: {queryString: '&names=no%20exist%20trim,no_exist,p3__split&prefixes=no%20exist%20trim,p2'}}}),'splits.filterQuery must correspond to the split filter query');
789
+
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'feature flag declarations must be cached');
790
+
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.split.p3__split'),JSON.stringify(splitDeclarations.p3__split),'feature flag declarations must be cached');
791
+
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.hash'),getStorageHash({ ...baseConfig,sync: {__splitFiltersValidation: {queryString: '&names=no%20exist%20trim,no_exist,p3__split&prefixes=no%20exist%20trim,p2'}}}),'Storage hash must correspond to the split filter query and SDK key');
0 commit comments