@@ -36,6 +36,44 @@ describe('launchSumSubSdk', () => {
3636 expect ( defaultBuilder . withLocale ) . toHaveBeenCalledWith ( 'en' ) ;
3737 } ) ;
3838
39+ it ( 'seeds the applicant with the account email and phone' , async ( ) => {
40+ await launchSumSubSdk ( ACCESS_TOKEN , jest . fn ( ) , 'en' , {
41+ email : 'user@bitpay.com' ,
42+ phone : '+15550001111' ,
43+ } ) ;
44+
45+ const builder = ( SNSMobileSDK . init as jest . Mock ) . mock . results [ 0 ] . value ;
46+ expect ( builder . withApplicantConf ) . toHaveBeenCalledWith ( {
47+ email : 'user@bitpay.com' ,
48+ phone : '+15550001111' ,
49+ } ) ;
50+ } ) ;
51+
52+ it ( 'omits applicant fields the account does not have' , async ( ) => {
53+ await launchSumSubSdk ( ACCESS_TOKEN , jest . fn ( ) , 'en' , {
54+ email : 'user@bitpay.com' ,
55+ } ) ;
56+
57+ const builder = ( SNSMobileSDK . init as jest . Mock ) . mock . results [ 0 ] . value ;
58+ expect ( builder . withApplicantConf ) . toHaveBeenCalledWith ( {
59+ email : 'user@bitpay.com' ,
60+ } ) ;
61+ } ) ;
62+
63+ it ( 'does not set an applicant conf when no account data is available' , async ( ) => {
64+ await launchSumSubSdk ( ACCESS_TOKEN , jest . fn ( ) , 'en' , { } ) ;
65+
66+ const builder = ( SNSMobileSDK . init as jest . Mock ) . mock . results [ 0 ] . value ;
67+ expect ( builder . withApplicantConf ) . not . toHaveBeenCalled ( ) ;
68+ } ) ;
69+
70+ it ( 'never sets a document country — the SDK cannot fix it client-side (RN-2904)' , async ( ) => {
71+ await launchSumSubSdk ( ACCESS_TOKEN , jest . fn ( ) ) ;
72+
73+ const builder = ( SNSMobileSDK . init as jest . Mock ) . mock . results [ 0 ] . value ;
74+ expect ( builder . withPreferredDocumentDefinitions ) . not . toHaveBeenCalled ( ) ;
75+ } ) ;
76+
3977 it ( 'resolves with the result returned by sdk.launch()' , async ( ) => {
4078 const result = await launchSumSubSdk ( ACCESS_TOKEN , jest . fn ( ) ) ;
4179
0 commit comments