Skip to content

Commit b915816

Browse files
MAGETWO-61368: [Github]Minicart not updating after sign in #7500
1 parent ef033b6 commit b915816

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/view/authentication-popup.test.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
*/
55

66
/* eslint max-nested-callbacks: 0 */
7-
87
define(['squire'], function (Squire) {
98
'use strict';
109

1110
var injector = new Squire(),
1211
loginAction = jasmine.createSpy(),
1312
mocks = {
1413
'Magento_Customer/js/action/login': loginAction,
15-
'Magento_Customer/js/customer-data': {get: function () {}},
14+
'Magento_Customer/js/customer-data': {
15+
get: jasmine.createSpy()
16+
},
1617
'Magento_Customer/js/model/authentication-popup': {
1718
createPopUp: jasmine.createSpy(),
1819
modalWindow: null
@@ -22,13 +23,13 @@ define(['squire'], function (Squire) {
2223
},
2324
obj;
2425

25-
loginAction.registerLoginCallback = function () {};
26-
window.authenticationPopup = {
27-
customerRegisterUrl: 'register_url',
28-
customerForgotPasswordUrl: 'forgot_password_url',
29-
autocomplete: 'autocomplete_flag',
30-
baseUrl: 'base_url'
31-
};
26+
loginAction.registerLoginCallback = jasmine.createSpy();
27+
window.authenticationPopup = {
28+
customerRegisterUrl: 'register_url',
29+
customerForgotPasswordUrl: 'forgot_password_url',
30+
autocomplete: 'autocomplete_flag',
31+
baseUrl: 'base_url'
32+
};
3233

3334
beforeEach(function (done) {
3435
injector.mock(mocks);
@@ -45,7 +46,9 @@ define(['squire'], function (Squire) {
4546
describe('Magento_Customer/js/view/authentication-popup', function () {
4647
describe('"isActive" method', function () {
4748
it('Check for return value.', function () {
48-
spyOn(mocks['Magento_Customer/js/customer-data'], 'get').and.returnValue(function() {return true;});
49+
mocks['Magento_Customer/js/customer-data'].get.and.returnValue(function () {
50+
return true;
51+
});
4952
expect(obj.isActive()).toBeFalsy();
5053
});
5154
});
@@ -67,8 +70,11 @@ define(['squire'], function (Squire) {
6770
currentTarget: '<form><input type="text" name="username" value="customer"/></form>',
6871
stopPropagation: jasmine.createSpy()
6972
};
73+
7074
expect(obj.login(null, event)).toBeFalsy();
71-
expect(mocks['Magento_Customer/js/action/login']).toHaveBeenCalledWith({username: 'customer'});
75+
expect(mocks['Magento_Customer/js/action/login']).toHaveBeenCalledWith({
76+
username: 'customer'
77+
});
7278
});
7379
});
7480
});

0 commit comments

Comments
 (0)