@@ -15,6 +15,7 @@ import {
15
15
} from '../checkout' ;
16
16
import { getCheckoutStoreState } from '../checkout/checkouts.mock' ;
17
17
import { MutationObserverFactory } from '../common/dom' ;
18
+ import { ErrorLogger } from '../common/error' ;
18
19
import { Registry } from '../common/registry' ;
19
20
import { ConfigActionCreator , ConfigRequestSender } from '../config' ;
20
21
import { FormFieldsActionCreator , FormFieldsRequestSender } from '../form' ;
@@ -44,6 +45,7 @@ describe('CustomerStrategyActionCreator', () => {
44
45
let store : CheckoutStore ;
45
46
let strategy : DefaultCustomerStrategy ;
46
47
let paymentIntegrationService : PaymentIntegrationService ;
48
+ let errorLogger : ErrorLogger ;
47
49
48
50
beforeEach ( ( ) => {
49
51
const requestSender = createRequestSender ( ) ;
@@ -69,6 +71,9 @@ describe('CustomerStrategyActionCreator', () => {
69
71
store = createCheckoutStore ( state ) ;
70
72
71
73
paymentIntegrationService = createPaymentIntegrationService ( store ) ;
74
+ errorLogger = {
75
+ log : jest . fn ( ) ,
76
+ } ;
72
77
73
78
customerRegistryV2 = createCustomerStrategyRegistryV2 ( paymentIntegrationService , { } ) ;
74
79
registry = createCustomerStrategyRegistry ( store , createRequestSender ( ) , 'en' ) ;
@@ -105,6 +110,7 @@ describe('CustomerStrategyActionCreator', () => {
105
110
registry ,
106
111
customerRegistryV2 ,
107
112
paymentIntegrationService ,
113
+ errorLogger ,
108
114
) ;
109
115
110
116
await from ( actionCreator . initialize ( { methodId : 'default' } ) ( store ) )
@@ -119,6 +125,7 @@ describe('CustomerStrategyActionCreator', () => {
119
125
registry ,
120
126
customerRegistryV2 ,
121
127
paymentIntegrationService ,
128
+ errorLogger ,
122
129
) ;
123
130
const options = { methodId : 'default' } ;
124
131
@@ -132,6 +139,7 @@ describe('CustomerStrategyActionCreator', () => {
132
139
registry ,
133
140
customerRegistryV2 ,
134
141
paymentIntegrationService ,
142
+ errorLogger ,
135
143
) ;
136
144
const strategy = registry . get ( 'amazon' ) ;
137
145
@@ -147,6 +155,7 @@ describe('CustomerStrategyActionCreator', () => {
147
155
registry ,
148
156
customerRegistryV2 ,
149
157
paymentIntegrationService ,
158
+ errorLogger ,
150
159
) ;
151
160
const actions = await from ( actionCreator . initialize ( { methodId : 'default' } ) ( store ) )
152
161
. pipe ( toArray ( ) )
@@ -169,6 +178,7 @@ describe('CustomerStrategyActionCreator', () => {
169
178
registry ,
170
179
customerRegistryV2 ,
171
180
paymentIntegrationService ,
181
+ errorLogger ,
172
182
) ;
173
183
const initializeError = new Error ( ) ;
174
184
const errorHandler = jest . fn ( ( action ) => of ( action ) ) ;
@@ -211,6 +221,7 @@ describe('CustomerStrategyActionCreator', () => {
211
221
registry ,
212
222
customerRegistryV2 ,
213
223
paymentIntegrationService ,
224
+ errorLogger ,
214
225
) ;
215
226
216
227
await from ( actionCreator . deinitialize ( { methodId : 'default' } ) ( store ) )
@@ -225,6 +236,7 @@ describe('CustomerStrategyActionCreator', () => {
225
236
registry ,
226
237
customerRegistryV2 ,
227
238
paymentIntegrationService ,
239
+ errorLogger ,
228
240
) ;
229
241
const options = { methodId : 'default' } ;
230
242
@@ -238,6 +250,7 @@ describe('CustomerStrategyActionCreator', () => {
238
250
registry ,
239
251
customerRegistryV2 ,
240
252
paymentIntegrationService ,
253
+ errorLogger ,
241
254
) ;
242
255
const strategy = registry . get ( 'amazon' ) ;
243
256
@@ -253,6 +266,7 @@ describe('CustomerStrategyActionCreator', () => {
253
266
registry ,
254
267
customerRegistryV2 ,
255
268
paymentIntegrationService ,
269
+ errorLogger ,
256
270
) ;
257
271
const actions = await from ( actionCreator . deinitialize ( { methodId : 'default' } ) ( store ) )
258
272
. pipe ( toArray ( ) )
@@ -275,6 +289,7 @@ describe('CustomerStrategyActionCreator', () => {
275
289
registry ,
276
290
customerRegistryV2 ,
277
291
paymentIntegrationService ,
292
+ errorLogger ,
278
293
) ;
279
294
const deinitializeError = new Error ( ) ;
280
295
const errorHandler = jest . fn ( ( action ) => of ( action ) ) ;
@@ -311,6 +326,7 @@ describe('CustomerStrategyActionCreator', () => {
311
326
registry ,
312
327
customerRegistryV2 ,
313
328
paymentIntegrationService ,
329
+ errorLogger ,
314
330
) ;
315
331
316
332
await actionCreator
@@ -326,6 +342,7 @@ describe('CustomerStrategyActionCreator', () => {
326
342
registry ,
327
343
customerRegistryV2 ,
328
344
paymentIntegrationService ,
345
+ errorLogger ,
329
346
) ;
330
347
const credentials = { email :
'[email protected] ' , password :
'password1' } ;
331
348
const options = { methodId : 'default' } ;
@@ -340,6 +357,7 @@ describe('CustomerStrategyActionCreator', () => {
340
357
registry ,
341
358
customerRegistryV2 ,
342
359
paymentIntegrationService ,
360
+ errorLogger ,
343
361
) ;
344
362
const actions = await actionCreator
345
363
. signIn ( { email :
'[email protected] ' , password :
'password1' } , { methodId :
'default' } )
@@ -357,6 +375,7 @@ describe('CustomerStrategyActionCreator', () => {
357
375
registry ,
358
376
customerRegistryV2 ,
359
377
paymentIntegrationService ,
378
+ errorLogger ,
360
379
) ;
361
380
const signInError = new Error ( ) ;
362
381
const errorHandler = jest . fn ( ( action ) => of ( action ) ) ;
@@ -391,6 +410,7 @@ describe('CustomerStrategyActionCreator', () => {
391
410
registry ,
392
411
customerRegistryV2 ,
393
412
paymentIntegrationService ,
413
+ errorLogger ,
394
414
) ;
395
415
396
416
await actionCreator . signOut ( { methodId : 'default' } ) . pipe ( toArray ( ) ) . toPromise ( ) ;
@@ -403,6 +423,7 @@ describe('CustomerStrategyActionCreator', () => {
403
423
registry ,
404
424
customerRegistryV2 ,
405
425
paymentIntegrationService ,
426
+ errorLogger ,
406
427
) ;
407
428
const options = { methodId : 'default' } ;
408
429
@@ -416,6 +437,7 @@ describe('CustomerStrategyActionCreator', () => {
416
437
registry ,
417
438
customerRegistryV2 ,
418
439
paymentIntegrationService ,
440
+ errorLogger ,
419
441
) ;
420
442
const actions = await actionCreator
421
443
. signOut ( { methodId : 'default' } )
@@ -439,6 +461,7 @@ describe('CustomerStrategyActionCreator', () => {
439
461
registry ,
440
462
customerRegistryV2 ,
441
463
paymentIntegrationService ,
464
+ errorLogger ,
442
465
) ;
443
466
const signOutError = new Error ( ) ;
444
467
const errorHandler = jest . fn ( ( action ) => of ( action ) ) ;
@@ -472,6 +495,7 @@ describe('CustomerStrategyActionCreator', () => {
472
495
registry ,
473
496
customerRegistryV2 ,
474
497
paymentIntegrationService ,
498
+ errorLogger ,
475
499
) ;
476
500
const options = { methodId : 'default' } ;
477
501
const fakeMethod = jest . fn ( ( ) => Promise . resolve ( ) ) ;
@@ -486,6 +510,7 @@ describe('CustomerStrategyActionCreator', () => {
486
510
registry ,
487
511
customerRegistryV2 ,
488
512
paymentIntegrationService ,
513
+ errorLogger ,
489
514
) ;
490
515
const actions = await actionCreator
491
516
. widgetInteraction (
@@ -512,6 +537,7 @@ describe('CustomerStrategyActionCreator', () => {
512
537
registry ,
513
538
customerRegistryV2 ,
514
539
paymentIntegrationService ,
540
+ errorLogger ,
515
541
) ;
516
542
const signInError = new Error ( ) ;
517
543
const errorHandler = jest . fn ( ( action ) => of ( action ) ) ;
0 commit comments