Skip to content

Commit cdfc681

Browse files
authored
Fix js unit test failures
1 parent dd862a2 commit cdfc681

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/customer-data.test.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,16 @@ define([
7474
originalReload = obj.reload;
7575
originalInitNamespaceStorage = $.initNamespaceStorage;
7676
spyOn(obj, 'reload').and.returnValue(true);
77-
spyOn($, 'initNamespaceStorage').and.returnValue(true);
77+
spyOn($, 'initNamespaceStorage').and.callFake(function (name) {
78+
let ns = {
79+
localStorage: {cookie: false, _ns: name},
80+
sessionStorage: {cookie: false, _ns: name}
81+
};
82+
83+
$.namespaceStorages[name] = ns;
84+
85+
return ns;
86+
});
7887
spyOn(dataProvider, 'getFromStorage');
7988
spyOn(storage, 'keys').and.returnValue(['section']);
8089
spyOn(storageInvalidation, 'keys').and.returnValue(['section']);
@@ -83,6 +92,7 @@ define([
8392
afterEach(function () {
8493
obj.reload = originalReload;
8594
$.initNameSpaceStorage = originalInitNamespaceStorage;
95+
$.namespaceStorages={};
8696
});
8797

8898
it('Should be defined', function () {

0 commit comments

Comments
 (0)