@@ -5,14 +5,11 @@ import {
5
5
walletPayOnShipping
6
6
} from '@boldcommerce/checkout-frontend-library' ;
7
7
import { applicationStateMock } from '@boldcommerce/checkout-frontend-library/lib/variables/mocks' ;
8
- import { displayError } from 'src' ;
9
8
import { ppcpOnShippingChange } from 'src/paypal/ppcp_buttons/ppcpOnShippingChange' ;
10
9
import { OnShippingChangeActions , OnShippingChangeData } from '@paypal/paypal-js/types/components/buttons' ;
11
10
12
11
jest . mock ( '@boldcommerce/checkout-frontend-library/lib/walletPay/walletPayOnShipping' ) ;
13
- jest . mock ( 'src/actions/displayError' ) ;
14
12
const walletPayOnShippingMock = mocked ( walletPayOnShipping , true ) ;
15
- const displayErrorMock = mocked ( displayError , true ) ;
16
13
17
14
describe ( 'testing ppcpOnShippingChange function' , ( ) => {
18
15
@@ -52,7 +49,7 @@ describe('testing ppcpOnShippingChange function', () => {
52
49
53
50
await ppcpOnShippingChange ( dataMock , actionMock ) ;
54
51
expect ( walletPayOnShippingMock ) . toHaveBeenCalledTimes ( 1 ) ;
55
- expect ( displayErrorMock ) . toHaveBeenCalledTimes ( 0 ) ;
52
+ expect ( actionMock . reject ) . toHaveBeenCalledTimes ( 0 ) ;
56
53
} ) ;
57
54
58
55
@@ -62,8 +59,7 @@ describe('testing ppcpOnShippingChange function', () => {
62
59
walletPayOnShippingMock . mockReturnValue ( Promise . resolve ( paymentReturn ) ) ;
63
60
64
61
await ppcpOnShippingChange ( dataMock , actionMock ) ;
65
- expect ( displayErrorMock ) . toHaveBeenCalledTimes ( 1 ) ;
66
- expect ( displayErrorMock ) . toHaveBeenCalledWith ( 'There was an unknown error while getting the shipping details.' , 'payment_gateway' , 'unknown_error' ) ;
62
+ expect ( walletPayOnShippingMock ) . toHaveBeenCalledTimes ( 1 ) ;
67
63
expect ( actionMock . reject ) . toHaveBeenCalledTimes ( 1 ) ;
68
64
} ) ;
69
65
0 commit comments