@@ -118,24 +118,25 @@ describe('BraintreePaypalPaymentStrategy', () => {
118
118
checkoutMock . getCart = jest . fn ( ( ) => getCart ( ) ) ;
119
119
checkoutMock . getBillingAddress = jest . fn ( ( ) => getBillingAddress ( ) ) ;
120
120
checkoutMock . getConfig = jest . fn ( ( ) => getAppConfig ( ) . storeConfig ) ;
121
-
122
- return braintreePaypalPaymentStrategy . initialize ( options ) ;
123
121
} ) ;
124
122
125
123
it ( 'calls submit order with the order request information' , async ( ) => {
124
+ await braintreePaypalPaymentStrategy . initialize ( options ) ;
126
125
await braintreePaypalPaymentStrategy . execute ( orderRequestBody , options ) ;
127
126
128
127
expect ( orderActionCreator . submitOrder ) . toHaveBeenCalledWith ( omit ( orderRequestBody , 'payment' ) , expect . any ( Boolean ) , expect . any ( Object ) ) ;
129
128
expect ( store . dispatch ) . toHaveBeenCalledWith ( submitOrderAction ) ;
130
129
} ) ;
131
130
132
131
it ( 'asks for cart verification' , async ( ) => {
132
+ await braintreePaypalPaymentStrategy . initialize ( options ) ;
133
133
await braintreePaypalPaymentStrategy . execute ( orderRequestBody , options ) ;
134
134
135
135
expect ( orderActionCreator . submitOrder ) . toHaveBeenCalledWith ( expect . any ( Object ) , true , expect . any ( Object ) ) ;
136
136
} ) ;
137
137
138
138
it ( 'pass the options to submitOrder' , async ( ) => {
139
+ await braintreePaypalPaymentStrategy . initialize ( options ) ;
139
140
await braintreePaypalPaymentStrategy . execute ( orderRequestBody , options ) ;
140
141
141
142
expect ( orderActionCreator . submitOrder ) . toHaveBeenCalledWith ( expect . any ( Object ) , expect . any ( Boolean ) , options ) ;
@@ -151,6 +152,7 @@ describe('BraintreePaypalPaymentStrategy', () => {
151
152
} ,
152
153
} ;
153
154
155
+ await braintreePaypalPaymentStrategy . initialize ( options ) ;
154
156
await braintreePaypalPaymentStrategy . execute ( orderRequestBody , options ) ;
155
157
156
158
expect ( braintreePaymentProcessorMock . paypal ) . toHaveBeenCalledWith ( 190 , 'en_US' , 'USD' , false ) ;
@@ -179,6 +181,7 @@ describe('BraintreePaypalPaymentStrategy', () => {
179
181
it ( 'converts any error returned by braintree in a StandardError' , async ( ) => {
180
182
braintreePaymentProcessorMock . paypal = ( ) => Promise . reject ( { name : 'BraintreeError' , message : 'my_message' } ) ;
181
183
184
+ await braintreePaypalPaymentStrategy . initialize ( options ) ;
182
185
await expect ( braintreePaypalPaymentStrategy . execute ( orderRequestBody , options ) ) . rejects . toEqual ( expect . any ( StandardError ) ) ;
183
186
} ) ;
184
187
0 commit comments