Skip to content

Commit a741f8a

Browse files
author
olysenko
committed
Merge remote-tracking branch 'origin/MAGETWO-64834' into bugfixes
2 parents 816a867 + 9ce1d5c commit a741f8a

File tree

2 files changed

+13
-11
lines changed
  • app/code/Magento/Checkout/view/frontend/web/js/model/cart/totals-processor
  • dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/model/cart/totals-processor

2 files changed

+13
-11
lines changed

app/code/Magento/Checkout/view/frontend/web/js/model/cart/totals-processor/default.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ define([
4949
shippingCarrierCode: null
5050
};
5151

52-
if (quote.shippingMethod()) {
52+
if (quote.shippingMethod() && quote.shippingMethod()['method_code']) {
5353
data.shippingMethodCode = quote.shippingMethod()['method_code'];
5454
data.shippingCarrierCode = quote.shippingMethod()['carrier_code'];
5555
}
@@ -82,7 +82,7 @@ define([
8282
shippingCarrierCode: null
8383
};
8484

85-
if (quote.shippingMethod()) {
85+
if (quote.shippingMethod() && quote.shippingMethod()['method_code']) {
8686
data.shippingMethodCode = quote.shippingMethod()['method_code'];
8787
data.shippingCarrierCode = quote.shippingMethod()['carrier_code'];
8888
}

dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/model/cart/totals-processor/default.test.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ define([
3232
regionId: 'California',
3333
postcode: 90210
3434
},
35+
data = {
36+
totals: result,
37+
address: address,
38+
cartVersion: 1,
39+
shippingMethodCode: null,
40+
shippingCarrierCode: null
41+
},
3542
mocks = {
3643
'Magento_Checkout/js/model/resource-url-manager': {
3744
getUrlForTotalsEstimationForNewAddress: jasmine.createSpy().and.returnValue(
@@ -42,8 +49,7 @@ define([
4249
shippingMethod: ko.observable({
4350
'method_code': 'flatrate',
4451
'carrier_code': 'flatrate'
45-
}
46-
),
52+
}),
4753
setTotals: jasmine.createSpy()
4854
},
4955
'mage/storage': {
@@ -66,13 +72,6 @@ define([
6672
set: jasmine.createSpy()
6773
}
6874
},
69-
data = {
70-
totals: result,
71-
address: address,
72-
cartVersion: 1,
73-
shippingMethodCode: 'flatrate',
74-
shippingCarrierCode: 'flatrate'
75-
},
7675
defaultProcessor;
7776

7877
beforeEach(function (done) {
@@ -112,6 +111,9 @@ define([
112111
);
113112
spyOn(mocks['Magento_Checkout/js/model/cart/cache'], 'get');
114113
spyOn(mocks['mage/storage'], 'post').and.callFake(function () {
114+
data.shippingMethodCode = mocks['Magento_Checkout/js/model/quote'].shippingMethod()['method_code'];
115+
data.shippingCarrierCode = mocks['Magento_Checkout/js/model/quote'].shippingMethod()['carrier_code'];
116+
115117
return new $.Deferred().resolve(result);
116118
});
117119
expect(defaultProcessor.estimateTotals(address)).toBeUndefined();

0 commit comments

Comments
 (0)