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.true(console.log.calledWithMatch('clearOnInit was set and cache was not cleared in the last 24 hours. Cleaning up cache'),'It should log a message about cleaning up cache');
825
+
826
+
client.once(client.Event.SDK_READY_FROM_CACHE,()=>t.fail('It should not emit SDK_READY_FROM_CACHE because clearOnInit is true.'));
827
+
828
+
awaitclient.ready();
829
+
t.equal(manager.names().sort().length,32,'active splits should be present for evaluation');
830
+
831
+
awaitsplitio.destroy();
832
+
t.equal(localStorage.getItem('readyFromCache_10.SPLITIO.splits.till'),'1457552620999','splits.till must correspond to the till of the last successfully fetched Splits');
833
+
t.equal(localStorage.getItem('readyFromCache_10.SPLITIO.hash'),expectedHashNullFilter,'Storage hash must not be changed');
834
+
t.true(nearlyEqual(parseInt(localStorage.getItem('readyFromCache_10.SPLITIO.lastClear')),Date.now()),'lastClear timestamp must be set');
835
+
836
+
// Start again with cached data and lastClear item within the last 24 hours -> no cache cleanup
t.equal(manager.names().sort().length,32,'active splits should be present for evaluation');
847
+
t.false(console.log.calledWithMatch('clearOnInit was set and cache was not cleared in the last 24 hours. Cleaning up cache'),'It should log a message about cleaning up cache');
848
+
849
+
awaitsplitio.destroy();
850
+
851
+
852
+
// Start again with cached data and lastClear item older than 24 hours -> cache cleanup
853
+
console.log.resetHistory();
854
+
localStorage.setItem('readyFromCache_10.SPLITIO.lastClear',Date.now()-25*60*60*1000);// 25 hours ago
t.equal(manager.names().sort().length,32,'active splits should be present for evaluation');
867
+
t.true(console.log.calledWithMatch('clearOnInit was set and cache was not cleared in the last 24 hours. Cleaning up cache'),'It should log a message about cleaning up cache');
0 commit comments