Skip to content

Commit 1fdf255

Browse files
MAGETWO-95501: Checkout page does not provide shipping methods option on cloud env
1 parent 7845493 commit 1fdf255

File tree

2 files changed

+71
-1
lines changed

2 files changed

+71
-1
lines changed

app/code/Magento/Checkout/view/frontend/web/js/model/error-processor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ define([
2929
try {
3030
error = JSON.parse(response.responseText);
3131
} catch (exception) {
32-
error = $t('Something went wrong with your request. Please try again later.')
32+
error = $t('Something went wrong with your request. Please try again later.');
3333
}
3434
messageContainer.addErrorMessage(error);
3535
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
/*eslint max-nested-callbacks: 0*/
7+
define([
8+
'squire'
9+
], function (Squire) {
10+
'use strict';
11+
12+
describe('Magento_Checkout/js/model/error-processor', function () {
13+
var injector = new Squire(),
14+
mocks = {
15+
'mage/url': {
16+
/** Method stub. */
17+
build: jasmine.createSpy()
18+
}
19+
},
20+
model;
21+
22+
beforeEach(function (done) {
23+
injector.mock(mocks);
24+
injector.require([
25+
'Magento_Checkout/js/model/error-processor'
26+
], function (processor) {
27+
model = processor;
28+
29+
done();
30+
});
31+
});
32+
33+
describe('Check process method', function () {
34+
it('check on success response with valid response data', function () {
35+
var messageObject = {
36+
message: 'Valid error message!'
37+
},
38+
messageContainer = jasmine.createSpyObj('globalMessageList', ['addErrorMessage']);
39+
40+
model.process({
41+
status: 200,
42+
responseText: JSON.stringify(messageObject)
43+
}, messageContainer);
44+
expect(messageContainer.addErrorMessage).toHaveBeenCalledWith(messageObject);
45+
});
46+
47+
it('check on success response with invalid response data', function () {
48+
var messageContainer = jasmine.createSpyObj('globalMessageList', ['addErrorMessage']);
49+
50+
model.process({
51+
status: 200,
52+
responseText: ''
53+
}, messageContainer);
54+
expect(messageContainer.addErrorMessage)
55+
.toHaveBeenCalledWith('Something went wrong with your request. Please try again later.');
56+
});
57+
58+
it('check on failed status', function () {
59+
var messageContainer = jasmine.createSpyObj('globalMessageList', ['addErrorMessage']);
60+
61+
model.process({
62+
status: 401,
63+
responseText: ''
64+
}, messageContainer);
65+
expect(mocks['mage/url'].build)
66+
.toHaveBeenCalled();
67+
});
68+
});
69+
});
70+
});

0 commit comments

Comments
 (0)