@@ -20,13 +20,21 @@ define([
20
20
21
21
var injector = new Squire ( ) ,
22
22
rates = 'flatrate' ,
23
+ totals = {
24
+ tax : 0.1 ,
25
+ totals : 10
26
+ } ,
27
+ cartData = {
28
+ totals : totals ,
29
+ rates : null
30
+ } ,
23
31
mocks = {
24
32
'Magento_Checkout/js/model/quote' : {
25
33
shippingAddress : ko . observable ( ) ,
26
34
isVirtual : function ( ) { } ,
27
35
billingAddress : ko . observable ( ) ,
28
- shippingMethod : ko . observable ( )
29
-
36
+ shippingMethod : ko . observable ( ) ,
37
+ setTotals : function ( ) { }
30
38
} ,
31
39
'Magento_Checkout/js/model/shipping-rate-processor/new-address' : {
32
40
getRates : jasmine . createSpy ( )
@@ -42,7 +50,7 @@ define([
42
50
} ,
43
51
'Magento_Checkout/js/model/cart/cache' : {
44
52
isChanged : function ( ) { } ,
45
- get : jasmine . createSpy ( ) . and . returnValue ( rates ) ,
53
+ get : jasmine . createSpy ( ) . and . returnValues ( rates , cartData ) ,
46
54
set : jasmine . createSpy ( )
47
55
} ,
48
56
'Magento_Customer/js/customer-data' : {
@@ -90,13 +98,16 @@ define([
90
98
spyOn ( mocks [ 'Magento_Checkout/js/model/quote' ] , 'isVirtual' ) . and . returnValue ( false ) ;
91
99
spyOn ( mocks [ 'Magento_Checkout/js/model/cart/cache' ] , 'isChanged' ) . and . returnValue ( false ) ;
92
100
spyOn ( mocks [ 'Magento_Checkout/js/model/shipping-service' ] , 'setShippingRates' ) ;
101
+ spyOn ( mocks [ 'Magento_Checkout/js/model/quote' ] , 'setTotals' ) ;
93
102
mocks [ 'Magento_Checkout/js/model/quote' ] . shippingAddress ( {
94
103
id : 2 ,
95
104
getType : function ( ) {
96
105
return 'address_type_test' ;
97
106
}
98
107
} ) ;
108
+ expect ( mocks [ 'Magento_Checkout/js/model/cart/cache' ] . get ( 'cart-data' ) ) . toBe ( cartData ) ;
99
109
expect ( mocks [ 'Magento_Checkout/js/model/shipping-service' ] . setShippingRates ) . toHaveBeenCalledWith ( rates ) ;
110
+ expect ( mocks [ 'Magento_Checkout/js/model/quote' ] . setTotals ) . toHaveBeenCalledWith ( cartData . totals ) ;
100
111
expect ( mocks [ 'Magento_Checkout/js/model/cart/totals-processor/default' ] . estimateTotals )
101
112
. not . toHaveBeenCalled ( ) ;
102
113
expect ( mocks [ 'Magento_Checkout/js/model/shipping-rate-processor/new-address' ] . getRates )
0 commit comments