wallet-stack 1.0.0-alpha.131 → 1.0.0-alpha.133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/locales/base/translation.json +11 -0
- package/package.json +2 -3
- package/src/analytics/Events.tsx +3 -10
- package/src/analytics/Properties.tsx +9 -25
- package/src/analytics/docs.ts +11 -8
- package/src/app/ErrorMessages.ts +1 -7
- package/src/identity/actions.ts +1 -97
- package/src/identity/contactMapping.test.ts +3 -28
- package/src/identity/contactMapping.ts +2 -88
- package/src/identity/reducer.ts +0 -77
- package/src/identity/saga.ts +2 -85
- package/src/identity/selectors.ts +0 -2
- package/src/images/Images.ts +3 -0
- package/src/images/assets/invite-modal.png +0 -0
- package/src/images/assets/invite-modal@1.5x.png +0 -0
- package/src/images/assets/invite-modal@2x.png +0 -0
- package/src/images/assets/invite-modal@3x.png +0 -0
- package/src/images/assets/invite-modal@4x.png +0 -0
- package/src/images/assets/minipay.png +0 -0
- package/src/images/assets/minipay@1.5x.png +0 -0
- package/src/images/assets/minipay@2x.png +0 -0
- package/src/images/assets/minipay@3x.png +0 -0
- package/src/images/assets/minipay@4x.png +0 -0
- package/src/images/assets/valora.png +0 -0
- package/src/images/assets/valora@1.5x.png +0 -0
- package/src/images/assets/valora@2x.png +0 -0
- package/src/images/assets/valora@3x.png +0 -0
- package/src/images/assets/valora@4x.png +0 -0
- package/src/index.d.ts +0 -1
- package/src/navigator/Navigator.tsx +10 -14
- package/src/navigator/Screens.tsx +2 -2
- package/src/navigator/types.tsx +5 -6
- package/src/qrcode/utils.test.tsx +4 -96
- package/src/qrcode/utils.ts +5 -114
- package/src/redux/migrations.test.ts +13 -0
- package/src/redux/migrations.ts +4 -0
- package/src/redux/store.test.ts +1 -2
- package/src/redux/store.ts +1 -1
- package/src/send/SelectRecipientAddress.test.tsx +146 -0
- package/src/send/SelectRecipientAddress.tsx +166 -0
- package/src/send/SendConfirmation.test.tsx +28 -0
- package/src/send/SendConfirmation.tsx +18 -1
- package/src/send/SendInvite.test.tsx +107 -0
- package/src/send/SendInvite.tsx +99 -0
- package/src/send/SendSelectRecipient.test.tsx +44 -223
- package/src/send/SendSelectRecipient.tsx +41 -149
- package/src/send/actions.ts +0 -26
- package/src/send/saga.ts +1 -6
- package/src/components/AccountNumberCard.tsx +0 -23
- package/src/components/ErrorMessageInline.tsx +0 -78
- package/src/components/SingleDigitInput.tsx +0 -53
- package/src/icons/HamburgerCard.tsx +0 -55
- package/src/identity/saga.test.ts +0 -103
- package/src/identity/secureSend.ts +0 -171
- package/src/send/ValidateRecipientAccount.test.tsx +0 -182
- package/src/send/ValidateRecipientAccount.tsx +0 -392
- package/src/send/ValidateRecipientIntro.test.tsx +0 -61
- package/src/send/ValidateRecipientIntro.tsx +0 -136
- package/src/send/__snapshots__/ValidateRecipientAccount.test.tsx.snap +0 -777
|
@@ -2,13 +2,11 @@ import Clipboard from '@react-native-clipboard/clipboard'
|
|
|
2
2
|
import { act, fireEvent, render, waitFor } from '@testing-library/react-native'
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { Provider } from 'react-redux'
|
|
5
|
-
import Share from 'react-native-share'
|
|
6
5
|
import AppAnalytics from 'src/analytics/AppAnalytics'
|
|
7
6
|
import { SendEvents } from 'src/analytics/Events'
|
|
8
7
|
import { SendOrigin } from 'src/analytics/types'
|
|
9
8
|
import { getAppConfig } from 'src/appConfig'
|
|
10
9
|
import { fetchAddressVerification, fetchAddressesAndValidate } from 'src/identity/actions'
|
|
11
|
-
import { AddressValidationType } from 'src/identity/reducer'
|
|
12
10
|
import { RecipientVerificationStatus } from 'src/identity/types'
|
|
13
11
|
import { navigate } from 'src/navigator/NavigationService'
|
|
14
12
|
import { Screens } from 'src/navigator/Screens'
|
|
@@ -204,7 +202,7 @@ describe('SendSelectRecipient', () => {
|
|
|
204
202
|
})
|
|
205
203
|
expect(getByTestId('SelectRecipient/NoResults')).toBeTruthy()
|
|
206
204
|
})
|
|
207
|
-
it('navigates to send amount when
|
|
205
|
+
it('navigates to send amount when a verified phone recipient is tapped in search results', async () => {
|
|
208
206
|
jest
|
|
209
207
|
.mocked(getRecipientVerificationStatus)
|
|
210
208
|
.mockReturnValue(RecipientVerificationStatus.VERIFIED)
|
|
@@ -225,15 +223,6 @@ describe('SendSelectRecipient', () => {
|
|
|
225
223
|
fireEvent.press(getByTestId('RecipientItem'))
|
|
226
224
|
})
|
|
227
225
|
|
|
228
|
-
expect(getByTestId('SendOrInviteButton')).toBeTruthy()
|
|
229
|
-
expect(getByTestId('SendOrInviteButton')).toHaveTextContent(
|
|
230
|
-
'sendSelectRecipient.buttons.send',
|
|
231
|
-
{ exact: false }
|
|
232
|
-
)
|
|
233
|
-
|
|
234
|
-
await act(() => {
|
|
235
|
-
fireEvent.press(getByTestId('SendOrInviteButton'))
|
|
236
|
-
})
|
|
237
226
|
expect(AppAnalytics.track).toHaveBeenCalledWith(SendEvents.send_select_recipient_send_press, {
|
|
238
227
|
recipientType: RecipientType.PhoneNumber,
|
|
239
228
|
})
|
|
@@ -247,7 +236,7 @@ describe('SendSelectRecipient', () => {
|
|
|
247
236
|
isMiniPayRecipient: false,
|
|
248
237
|
})
|
|
249
238
|
})
|
|
250
|
-
it('navigates to send amount when address
|
|
239
|
+
it('navigates to send amount when an address is tapped and the user phone number is not verified', async () => {
|
|
251
240
|
const store = createMockStore(defaultStore)
|
|
252
241
|
|
|
253
242
|
const { getByTestId } = render(
|
|
@@ -264,15 +253,6 @@ describe('SendSelectRecipient', () => {
|
|
|
264
253
|
fireEvent.press(getByTestId('RecipientItem'))
|
|
265
254
|
})
|
|
266
255
|
|
|
267
|
-
expect(getByTestId('SendOrInviteButton')).toBeTruthy()
|
|
268
|
-
expect(getByTestId('SendOrInviteButton')).toHaveTextContent(
|
|
269
|
-
'sendSelectRecipient.buttons.send',
|
|
270
|
-
{ exact: false }
|
|
271
|
-
)
|
|
272
|
-
|
|
273
|
-
await act(() => {
|
|
274
|
-
fireEvent.press(getByTestId('SendOrInviteButton'))
|
|
275
|
-
})
|
|
276
256
|
expect(AppAnalytics.track).toHaveBeenCalledWith(SendEvents.send_select_recipient_send_press, {
|
|
277
257
|
recipientType: RecipientType.Address,
|
|
278
258
|
})
|
|
@@ -286,14 +266,14 @@ describe('SendSelectRecipient', () => {
|
|
|
286
266
|
})
|
|
287
267
|
})
|
|
288
268
|
|
|
289
|
-
it('
|
|
269
|
+
it('dispatches address verification when an address is tapped and the user phone number is verified', async () => {
|
|
290
270
|
jest
|
|
291
271
|
.mocked(getRecipientVerificationStatus)
|
|
292
272
|
.mockReturnValue(RecipientVerificationStatus.VERIFIED)
|
|
293
273
|
|
|
294
274
|
const store = createMockStore(storeWithPhoneVerified)
|
|
295
275
|
|
|
296
|
-
const { getByTestId
|
|
276
|
+
const { getByTestId } = render(
|
|
297
277
|
<Provider store={store}>
|
|
298
278
|
<SendSelectRecipient {...mockScreenProps({})} />
|
|
299
279
|
</Provider>
|
|
@@ -317,17 +297,15 @@ describe('SendSelectRecipient', () => {
|
|
|
317
297
|
})
|
|
318
298
|
|
|
319
299
|
expect(store.getActions()).toEqual([fetchAddressVerification(mockAccount2.toLowerCase())])
|
|
320
|
-
expect(queryByTestId('UnknownAddressInfo')).toBeFalsy()
|
|
321
|
-
expect(getByTestId('SendOrInviteButton')).toBeTruthy()
|
|
322
300
|
})
|
|
323
|
-
it('does not
|
|
301
|
+
it('does not navigate when an unverified phone recipient is tapped and no share URL is configured', async () => {
|
|
324
302
|
jest
|
|
325
303
|
.mocked(getRecipientVerificationStatus)
|
|
326
304
|
.mockReturnValue(RecipientVerificationStatus.UNVERIFIED)
|
|
327
305
|
|
|
328
306
|
const store = createMockStore(storeWithPhoneVerified)
|
|
329
307
|
|
|
330
|
-
const { getByTestId
|
|
308
|
+
const { getByTestId } = render(
|
|
331
309
|
<Provider store={store}>
|
|
332
310
|
<SendSelectRecipient {...mockScreenProps({})} />
|
|
333
311
|
</Provider>
|
|
@@ -348,11 +326,10 @@ describe('SendSelectRecipient', () => {
|
|
|
348
326
|
})
|
|
349
327
|
|
|
350
328
|
expect(store.getActions()).toEqual([fetchAddressesAndValidate(mockE164Number2Invite)])
|
|
351
|
-
expect(
|
|
352
|
-
expect(getByTestId('SendOrInviteButton')).toBeTruthy()
|
|
329
|
+
expect(navigate).not.toHaveBeenCalled()
|
|
353
330
|
})
|
|
354
331
|
|
|
355
|
-
it('
|
|
332
|
+
it('navigates to the invite screen when an unverified phone number is tapped and share URL is configured', async () => {
|
|
356
333
|
const shareUrl = 'https://example.test/invite'
|
|
357
334
|
jest.mocked(getAppConfig).mockReturnValue({
|
|
358
335
|
displayName: 'Test App',
|
|
@@ -367,20 +344,6 @@ describe('SendSelectRecipient', () => {
|
|
|
367
344
|
.mocked(getRecipientVerificationStatus)
|
|
368
345
|
.mockReturnValue(RecipientVerificationStatus.UNVERIFIED)
|
|
369
346
|
|
|
370
|
-
let resolveShare!: (value: {
|
|
371
|
-
success: boolean
|
|
372
|
-
dismissedAction: boolean
|
|
373
|
-
message: string
|
|
374
|
-
}) => void
|
|
375
|
-
const sharePromise = new Promise<{
|
|
376
|
-
success: boolean
|
|
377
|
-
dismissedAction: boolean
|
|
378
|
-
message: string
|
|
379
|
-
}>((resolve) => {
|
|
380
|
-
resolveShare = resolve
|
|
381
|
-
})
|
|
382
|
-
jest.mocked(Share.open).mockReturnValueOnce(sharePromise)
|
|
383
|
-
|
|
384
347
|
const store = createMockStore(storeWithPhoneVerified)
|
|
385
348
|
|
|
386
349
|
const { getByTestId } = render(
|
|
@@ -397,33 +360,19 @@ describe('SendSelectRecipient', () => {
|
|
|
397
360
|
fireEvent.press(getByTestId('RecipientItem'))
|
|
398
361
|
})
|
|
399
362
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
// Analytics fires synchronously on tap, before the share sheet resolves
|
|
408
|
-
expect(AppAnalytics.track).toHaveBeenCalledWith(SendEvents.send_select_recipient_invite_press, {
|
|
409
|
-
recipientType: RecipientType.PhoneNumber,
|
|
363
|
+
expect(navigate).toHaveBeenCalledWith(Screens.SendInvite, {
|
|
364
|
+
recipient: expect.objectContaining({
|
|
365
|
+
e164PhoneNumber: mockE164Number2Invite,
|
|
366
|
+
recipientType: RecipientType.PhoneNumber,
|
|
367
|
+
}),
|
|
368
|
+
shareUrl,
|
|
410
369
|
})
|
|
411
|
-
expect(Share.open).toHaveBeenCalledWith(
|
|
412
|
-
expect.objectContaining({
|
|
413
|
-
message: expect.stringContaining(shareUrl),
|
|
414
|
-
url: shareUrl,
|
|
415
|
-
failOnCancel: false,
|
|
416
|
-
})
|
|
417
|
-
)
|
|
418
|
-
expect(navigate).not.toHaveBeenCalled()
|
|
419
370
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
await sharePromise
|
|
423
|
-
})
|
|
371
|
+
// Search text is preserved so the user can return to the same picker state.
|
|
372
|
+
expect(searchInput.props.value).toBe(mockE164Number2Invite)
|
|
424
373
|
})
|
|
425
374
|
|
|
426
|
-
it('
|
|
375
|
+
it('navigates and dispatches address verification when an unknown address is tapped and the user phone number is verified', async () => {
|
|
427
376
|
jest
|
|
428
377
|
.mocked(getRecipientVerificationStatus)
|
|
429
378
|
.mockReturnValue(RecipientVerificationStatus.UNVERIFIED)
|
|
@@ -455,10 +404,12 @@ describe('SendSelectRecipient', () => {
|
|
|
455
404
|
})
|
|
456
405
|
|
|
457
406
|
expect(store.getActions()).toEqual([fetchAddressVerification(mockAccount2.toLowerCase())])
|
|
458
|
-
expect(
|
|
459
|
-
|
|
407
|
+
expect(navigate).toHaveBeenCalledWith(
|
|
408
|
+
Screens.SendEnterAmount,
|
|
409
|
+
expect.objectContaining({ origin: SendOrigin.AppSendFlow })
|
|
410
|
+
)
|
|
460
411
|
})
|
|
461
|
-
it('
|
|
412
|
+
it('skips verification request for an address when the user phone number is not verified', async () => {
|
|
462
413
|
const store = createMockStore(defaultStore)
|
|
463
414
|
|
|
464
415
|
const { getByTestId } = render(
|
|
@@ -486,43 +437,11 @@ describe('SendSelectRecipient', () => {
|
|
|
486
437
|
})
|
|
487
438
|
|
|
488
439
|
expect(store.getActions()).toEqual([])
|
|
489
|
-
|
|
490
|
-
expect(
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
jest
|
|
494
|
-
.mocked(getRecipientVerificationStatus)
|
|
495
|
-
.mockReturnValue(RecipientVerificationStatus.UNVERIFIED)
|
|
496
|
-
|
|
497
|
-
const store = createMockStore(storeWithPhoneVerified)
|
|
498
|
-
|
|
499
|
-
const { getByTestId } = render(
|
|
500
|
-
<Provider store={store}>
|
|
501
|
-
<SendSelectRecipient {...mockScreenProps({})} />
|
|
502
|
-
</Provider>
|
|
440
|
+
// Navigation still proceeds — status is treated as UNVERIFIED locally.
|
|
441
|
+
expect(navigate).toHaveBeenCalledWith(
|
|
442
|
+
Screens.SendEnterAmount,
|
|
443
|
+
expect.objectContaining({ origin: SendOrigin.AppSendFlow })
|
|
503
444
|
)
|
|
504
|
-
await waitFor(() => {
|
|
505
|
-
expect(getByTestId('SendSelectRecipientSearchInput')).toBeTruthy()
|
|
506
|
-
})
|
|
507
|
-
const searchInput = getByTestId('SendSelectRecipientSearchInput')
|
|
508
|
-
|
|
509
|
-
await act(() => {
|
|
510
|
-
fireEvent.changeText(searchInput, mockAccount)
|
|
511
|
-
})
|
|
512
|
-
|
|
513
|
-
expect(getByTestId('RecipientItem')).toHaveTextContent(mockRecipient.name, { exact: false })
|
|
514
|
-
expect(getByTestId('RecipientItem')).toHaveTextContent(mockRecipient.displayNumber, {
|
|
515
|
-
exact: false,
|
|
516
|
-
})
|
|
517
|
-
|
|
518
|
-
await act(() => {
|
|
519
|
-
fireEvent.press(getByTestId('RecipientItem'))
|
|
520
|
-
})
|
|
521
|
-
|
|
522
|
-
expect(store.getActions()).toEqual([fetchAddressVerification(mockAccount)])
|
|
523
|
-
expect(getByTestId('UnknownAddressInfo')).toBeTruthy()
|
|
524
|
-
expect(getByTestId('SendOrInviteButton')).toBeTruthy()
|
|
525
|
-
expect(getByTestId('SendOrInviteButton')).toHaveTextContent('send', { exact: false })
|
|
526
445
|
})
|
|
527
446
|
it('shows paste button if clipboard has address content', async () => {
|
|
528
447
|
const store = createMockStore(defaultStore)
|
|
@@ -548,7 +467,7 @@ describe('SendSelectRecipient', () => {
|
|
|
548
467
|
await expect(pasteButtonAfterPress).rejects.toThrow()
|
|
549
468
|
})
|
|
550
469
|
|
|
551
|
-
it('navigates to send amount when phone
|
|
470
|
+
it('navigates to send amount when a verified phone recipient with a single address is tapped', async () => {
|
|
552
471
|
jest
|
|
553
472
|
.mocked(getRecipientVerificationStatus)
|
|
554
473
|
.mockReturnValue(RecipientVerificationStatus.VERIFIED)
|
|
@@ -556,9 +475,6 @@ describe('SendSelectRecipient', () => {
|
|
|
556
475
|
const store = createMockStore({
|
|
557
476
|
...storeWithPhoneVerified,
|
|
558
477
|
identity: {
|
|
559
|
-
secureSendPhoneNumberMapping: {
|
|
560
|
-
[mockE164Number3]: { addressValidationType: AddressValidationType.NONE },
|
|
561
|
-
},
|
|
562
478
|
e164NumberToAddress: { [mockE164Number3]: [mockAccount3] },
|
|
563
479
|
},
|
|
564
480
|
})
|
|
@@ -577,11 +493,6 @@ describe('SendSelectRecipient', () => {
|
|
|
577
493
|
fireEvent.press(getByTestId('RecipientItem'))
|
|
578
494
|
})
|
|
579
495
|
|
|
580
|
-
expect(getByTestId('SendOrInviteButton')).toBeTruthy()
|
|
581
|
-
|
|
582
|
-
await act(() => {
|
|
583
|
-
fireEvent.press(getByTestId('SendOrInviteButton'))
|
|
584
|
-
})
|
|
585
496
|
expect(AppAnalytics.track).toHaveBeenCalledWith(SendEvents.send_select_recipient_send_press, {
|
|
586
497
|
recipientType: RecipientType.PhoneNumber,
|
|
587
498
|
})
|
|
@@ -599,7 +510,7 @@ describe('SendSelectRecipient', () => {
|
|
|
599
510
|
isMiniPayRecipient: false,
|
|
600
511
|
})
|
|
601
512
|
})
|
|
602
|
-
it('navigates
|
|
513
|
+
it('navigates with isMiniPayRecipient when address is verified by minipay', async () => {
|
|
603
514
|
jest
|
|
604
515
|
.mocked(getRecipientVerificationStatus)
|
|
605
516
|
.mockReturnValue(RecipientVerificationStatus.VERIFIED)
|
|
@@ -607,9 +518,6 @@ describe('SendSelectRecipient', () => {
|
|
|
607
518
|
const store = createMockStore({
|
|
608
519
|
...storeWithPhoneVerified,
|
|
609
520
|
identity: {
|
|
610
|
-
secureSendPhoneNumberMapping: {
|
|
611
|
-
[mockE164Number3]: { addressValidationType: AddressValidationType.NONE },
|
|
612
|
-
},
|
|
613
521
|
e164NumberToAddress: { [mockE164Number3]: [mockAccount3] },
|
|
614
522
|
addressToVerifiedBy: { [mockAccount3]: 'minipay' },
|
|
615
523
|
},
|
|
@@ -628,9 +536,6 @@ describe('SendSelectRecipient', () => {
|
|
|
628
536
|
await act(() => {
|
|
629
537
|
fireEvent.press(getByTestId('RecipientItem'))
|
|
630
538
|
})
|
|
631
|
-
await act(() => {
|
|
632
|
-
fireEvent.press(getByTestId('SendOrInviteButton'))
|
|
633
|
-
})
|
|
634
539
|
|
|
635
540
|
expect(navigate).toHaveBeenCalledWith(Screens.SendEnterAmount, {
|
|
636
541
|
isFromScan: false,
|
|
@@ -646,7 +551,7 @@ describe('SendSelectRecipient', () => {
|
|
|
646
551
|
isMiniPayRecipient: true,
|
|
647
552
|
})
|
|
648
553
|
})
|
|
649
|
-
it('navigates to
|
|
554
|
+
it('navigates to address picker when phone number recipient has multiple verified addresses', async () => {
|
|
650
555
|
jest
|
|
651
556
|
.mocked(getRecipientVerificationStatus)
|
|
652
557
|
.mockReturnValue(RecipientVerificationStatus.VERIFIED)
|
|
@@ -654,9 +559,6 @@ describe('SendSelectRecipient', () => {
|
|
|
654
559
|
const store = createMockStore({
|
|
655
560
|
...storeWithPhoneVerified,
|
|
656
561
|
identity: {
|
|
657
|
-
secureSendPhoneNumberMapping: {
|
|
658
|
-
[mockE164Number3]: { addressValidationType: AddressValidationType.PARTIAL },
|
|
659
|
-
},
|
|
660
562
|
e164NumberToAddress: {
|
|
661
563
|
[mockE164Number3]: [mockAccount2.toLowerCase(), mockAccount3.toLowerCase()],
|
|
662
564
|
},
|
|
@@ -664,6 +566,10 @@ describe('SendSelectRecipient', () => {
|
|
|
664
566
|
[mockAccount2.toLowerCase()]: mockE164Number3,
|
|
665
567
|
[mockAccount3.toLowerCase()]: mockE164Number3,
|
|
666
568
|
},
|
|
569
|
+
addressToVerifiedBy: {
|
|
570
|
+
[mockAccount2.toLowerCase()]: 'valora',
|
|
571
|
+
[mockAccount3.toLowerCase()]: 'minipay',
|
|
572
|
+
},
|
|
667
573
|
},
|
|
668
574
|
})
|
|
669
575
|
|
|
@@ -681,22 +587,17 @@ describe('SendSelectRecipient', () => {
|
|
|
681
587
|
fireEvent.press(getByTestId('RecipientItem'))
|
|
682
588
|
})
|
|
683
589
|
|
|
684
|
-
expect(getByTestId('SendOrInviteButton')).toBeTruthy()
|
|
685
|
-
|
|
686
|
-
await act(() => {
|
|
687
|
-
fireEvent.press(getByTestId('SendOrInviteButton'))
|
|
688
|
-
})
|
|
689
590
|
expect(AppAnalytics.track).toHaveBeenCalledWith(SendEvents.send_select_recipient_send_press, {
|
|
690
591
|
recipientType: RecipientType.PhoneNumber,
|
|
691
592
|
})
|
|
692
|
-
expect(navigate).toHaveBeenCalledWith(Screens.
|
|
593
|
+
expect(navigate).toHaveBeenCalledWith(Screens.SelectRecipientAddress, {
|
|
693
594
|
defaultTokenIdOverride: undefined,
|
|
694
595
|
forceTokenId: undefined,
|
|
695
596
|
recipient: expect.any(Object),
|
|
696
597
|
origin: SendOrigin.AppSendFlow,
|
|
697
598
|
})
|
|
698
599
|
})
|
|
699
|
-
it('navigates to send enter amount when phone number
|
|
600
|
+
it('navigates to send enter amount when phone number has multiple raw addresses but only one with a verifier', async () => {
|
|
700
601
|
jest
|
|
701
602
|
.mocked(getRecipientVerificationStatus)
|
|
702
603
|
.mockReturnValue(RecipientVerificationStatus.VERIFIED)
|
|
@@ -704,12 +605,6 @@ describe('SendSelectRecipient', () => {
|
|
|
704
605
|
const store = createMockStore({
|
|
705
606
|
...storeWithPhoneVerified,
|
|
706
607
|
identity: {
|
|
707
|
-
secureSendPhoneNumberMapping: {
|
|
708
|
-
[mockE164Number3]: {
|
|
709
|
-
addressValidationType: AddressValidationType.NONE,
|
|
710
|
-
address: mockAccount3,
|
|
711
|
-
},
|
|
712
|
-
},
|
|
713
608
|
e164NumberToAddress: {
|
|
714
609
|
[mockE164Number3]: [mockAccount2.toLowerCase(), mockAccount3.toLowerCase()],
|
|
715
610
|
},
|
|
@@ -717,6 +612,9 @@ describe('SendSelectRecipient', () => {
|
|
|
717
612
|
[mockAccount2.toLowerCase()]: mockE164Number3,
|
|
718
613
|
[mockAccount3.toLowerCase()]: mockE164Number3,
|
|
719
614
|
},
|
|
615
|
+
addressToVerifiedBy: {
|
|
616
|
+
[mockAccount3.toLowerCase()]: 'valora',
|
|
617
|
+
},
|
|
720
618
|
},
|
|
721
619
|
})
|
|
722
620
|
|
|
@@ -734,11 +632,6 @@ describe('SendSelectRecipient', () => {
|
|
|
734
632
|
fireEvent.press(getByTestId('RecipientItem'))
|
|
735
633
|
})
|
|
736
634
|
|
|
737
|
-
expect(getByTestId('SendOrInviteButton')).toBeTruthy()
|
|
738
|
-
|
|
739
|
-
await act(() => {
|
|
740
|
-
fireEvent.press(getByTestId('SendOrInviteButton'))
|
|
741
|
-
})
|
|
742
635
|
expect(AppAnalytics.track).toHaveBeenCalledWith(SendEvents.send_select_recipient_send_press, {
|
|
743
636
|
recipientType: RecipientType.PhoneNumber,
|
|
744
637
|
})
|
|
@@ -747,7 +640,7 @@ describe('SendSelectRecipient', () => {
|
|
|
747
640
|
defaultTokenIdOverride: undefined,
|
|
748
641
|
forceTokenId: undefined,
|
|
749
642
|
recipient: {
|
|
750
|
-
address: mockAccount3,
|
|
643
|
+
address: mockAccount3.toLowerCase(),
|
|
751
644
|
displayNumber: '(415) 555-0123',
|
|
752
645
|
e164PhoneNumber: mockE164Number3,
|
|
753
646
|
recipientType: 'PhoneNumber',
|
|
@@ -757,7 +650,7 @@ describe('SendSelectRecipient', () => {
|
|
|
757
650
|
})
|
|
758
651
|
})
|
|
759
652
|
it.each([{ searchAddress: mockAccount2 }, { searchAddress: mockAccount3 }])(
|
|
760
|
-
'navigates to send enter amount with correct address if
|
|
653
|
+
'navigates to send enter amount with correct address if an address is entered which also maps to a phone number with multiple addresses',
|
|
761
654
|
async ({ searchAddress }) => {
|
|
762
655
|
jest
|
|
763
656
|
.mocked(getRecipientVerificationStatus)
|
|
@@ -766,11 +659,6 @@ describe('SendSelectRecipient', () => {
|
|
|
766
659
|
const store = createMockStore({
|
|
767
660
|
...storeWithPhoneVerified,
|
|
768
661
|
identity: {
|
|
769
|
-
secureSendPhoneNumberMapping: {
|
|
770
|
-
[mockE164Number3]: {
|
|
771
|
-
addressValidationType: AddressValidationType.PARTIAL,
|
|
772
|
-
},
|
|
773
|
-
},
|
|
774
662
|
e164NumberToAddress: {
|
|
775
663
|
[mockE164Number3]: [mockAccount2.toLowerCase(), mockAccount3.toLowerCase()],
|
|
776
664
|
},
|
|
@@ -778,71 +666,9 @@ describe('SendSelectRecipient', () => {
|
|
|
778
666
|
[mockAccount2.toLowerCase()]: mockE164Number3,
|
|
779
667
|
[mockAccount3.toLowerCase()]: mockE164Number3,
|
|
780
668
|
},
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
const { getByTestId } = render(
|
|
785
|
-
<Provider store={store}>
|
|
786
|
-
<SendSelectRecipient {...mockScreenProps({})} />
|
|
787
|
-
</Provider>
|
|
788
|
-
)
|
|
789
|
-
const searchInput = getByTestId('SendSelectRecipientSearchInput')
|
|
790
|
-
|
|
791
|
-
await act(() => {
|
|
792
|
-
fireEvent.changeText(searchInput, searchAddress)
|
|
793
|
-
})
|
|
794
|
-
await act(() => {
|
|
795
|
-
fireEvent.press(getByTestId('RecipientItem'))
|
|
796
|
-
})
|
|
797
|
-
|
|
798
|
-
expect(getByTestId('SendOrInviteButton')).toBeTruthy()
|
|
799
|
-
|
|
800
|
-
await act(() => {
|
|
801
|
-
fireEvent.press(getByTestId('SendOrInviteButton'))
|
|
802
|
-
})
|
|
803
|
-
expect(AppAnalytics.track).toHaveBeenCalledWith(SendEvents.send_select_recipient_send_press, {
|
|
804
|
-
recipientType: RecipientType.Address,
|
|
805
|
-
})
|
|
806
|
-
expect(navigate).toHaveBeenCalledWith(Screens.SendEnterAmount, {
|
|
807
|
-
isFromScan: false,
|
|
808
|
-
defaultTokenIdOverride: undefined,
|
|
809
|
-
forceTokenId: undefined,
|
|
810
|
-
recipient: {
|
|
811
|
-
address: searchAddress.toLowerCase(),
|
|
812
|
-
e164PhoneNumber: mockE164Number3,
|
|
813
|
-
recipientType: RecipientType.Address,
|
|
814
|
-
contactId: undefined,
|
|
815
|
-
displayNumber: undefined,
|
|
816
|
-
name: undefined,
|
|
817
|
-
thumbnailPath: undefined,
|
|
818
|
-
},
|
|
819
|
-
origin: SendOrigin.AppSendFlow,
|
|
820
|
-
isMiniPayRecipient: false,
|
|
821
|
-
})
|
|
822
|
-
}
|
|
823
|
-
)
|
|
824
|
-
it.each([{ searchAddress: mockAccount2 }, { searchAddress: mockAccount3 }])(
|
|
825
|
-
'navigates to send enter amount with correct address if a an address is entered which also has a phone number with secure send done with different address',
|
|
826
|
-
async ({ searchAddress }) => {
|
|
827
|
-
jest
|
|
828
|
-
.mocked(getRecipientVerificationStatus)
|
|
829
|
-
.mockReturnValue(RecipientVerificationStatus.VERIFIED)
|
|
830
|
-
|
|
831
|
-
const store = createMockStore({
|
|
832
|
-
...storeWithPhoneVerified,
|
|
833
|
-
identity: {
|
|
834
|
-
secureSendPhoneNumberMapping: {
|
|
835
|
-
[mockE164Number3]: {
|
|
836
|
-
addressValidationType: AddressValidationType.NONE,
|
|
837
|
-
address: mockAccount3,
|
|
838
|
-
},
|
|
839
|
-
},
|
|
840
|
-
e164NumberToAddress: {
|
|
841
|
-
[mockE164Number3]: [mockAccount2.toLowerCase(), mockAccount3.toLowerCase()],
|
|
842
|
-
},
|
|
843
|
-
addressToE164Number: {
|
|
844
|
-
[mockAccount2.toLowerCase()]: mockE164Number3,
|
|
845
|
-
[mockAccount3.toLowerCase()]: mockE164Number3,
|
|
669
|
+
addressToVerifiedBy: {
|
|
670
|
+
[mockAccount2.toLowerCase()]: 'valora',
|
|
671
|
+
[mockAccount3.toLowerCase()]: 'minipay',
|
|
846
672
|
},
|
|
847
673
|
},
|
|
848
674
|
})
|
|
@@ -861,11 +687,6 @@ describe('SendSelectRecipient', () => {
|
|
|
861
687
|
fireEvent.press(getByTestId('RecipientItem'))
|
|
862
688
|
})
|
|
863
689
|
|
|
864
|
-
expect(getByTestId('SendOrInviteButton')).toBeTruthy()
|
|
865
|
-
|
|
866
|
-
await act(() => {
|
|
867
|
-
fireEvent.press(getByTestId('SendOrInviteButton'))
|
|
868
|
-
})
|
|
869
690
|
expect(AppAnalytics.track).toHaveBeenCalledWith(SendEvents.send_select_recipient_send_press, {
|
|
870
691
|
recipientType: RecipientType.Address,
|
|
871
692
|
})
|
|
@@ -883,7 +704,7 @@ describe('SendSelectRecipient', () => {
|
|
|
883
704
|
thumbnailPath: undefined,
|
|
884
705
|
},
|
|
885
706
|
origin: SendOrigin.AppSendFlow,
|
|
886
|
-
isMiniPayRecipient:
|
|
707
|
+
isMiniPayRecipient: searchAddress.toLowerCase() === mockAccount3.toLowerCase(),
|
|
887
708
|
})
|
|
888
709
|
}
|
|
889
710
|
)
|