Skip to content

Commit

Permalink
Fix failing unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ihor-sviziev authored Aug 14, 2020
1 parent 176013f commit 2922c1c
Showing 1 changed file with 3 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ define([
sectionConfig,
originalGetJSON,
originalReload,
originalInitNamespaceStorage,
originalEach,
obj;

Expand Down Expand Up @@ -72,32 +71,19 @@ define([

beforeEach(function () {
originalReload = obj.reload;
originalInitNamespaceStorage = $.initNamespaceStorage;
spyOn(obj, 'reload').and.returnValue(true);
spyOn($, 'initNamespaceStorage').and.callFake(function (name) {
var ns = {
localStorage: {
cookie: false,
_ns: name
},
sessionStorage: {
cookie: false,
_ns: name
}
};

$.namespaceStorages[name] = ns;
//Init storage api library
$.initNamespaceStorage('mage-cache-storage').localStorage;
$.initNamespaceStorage('mage-cache-storage-section-invalidation').localStorage;

return ns;
});
spyOn(dataProvider, 'getFromStorage');
spyOn(storage, 'keys').and.returnValue(['section']);
spyOn(storageInvalidation, 'keys').and.returnValue(['section']);
});

afterEach(function () {
obj.reload = originalReload;
$.initNameSpaceStorage = originalInitNamespaceStorage;
$.namespaceStorages = {};
});

Expand Down

0 comments on commit 2922c1c

Please sign in to comment.