1
- import { createMagicAdminSDK } from '../../../lib/factories' ;
2
- import { API_KEY } from '../../../lib/constants' ;
3
1
import { createApiKeyMissingError } from '../../../../src/core/sdk-exceptions' ;
4
- import { get } from '../../../../src/utils/rest' ;
5
2
import { WalletType } from '../../../../src/types/wallet-types' ;
3
+ import { get } from '../../../../src/utils/rest' ;
4
+ import { API_KEY } from '../../../lib/constants' ;
5
+ import { createMagicAdminSDK } from '../../../lib/factories' ;
6
6
7
7
const successRes = Promise . resolve ( {
8
8
issuer : 'foo' ,
9
9
public_address : 'bar' ,
10
10
email : 'baz' ,
11
11
oauth_provider : 'foo1' ,
12
12
phone_number : '+1234' ,
13
+ username : 'buzz' ,
13
14
} ) ;
14
15
const successResWithWallets = Promise . resolve ( {
15
16
issuer : 'foo' ,
16
17
public_address : 'bar' ,
17
18
email : 'baz' ,
18
19
oauth_provider : 'foo1' ,
19
20
phone_number : '+1234' ,
21
+ username : 'buzz' ,
20
22
wallets : [
21
23
{
22
24
wallet_type : 'SOLANA' ,
23
25
network : 'MAINNET' ,
24
- public_address : 'barxyz'
25
- }
26
- ]
26
+ public_address : 'barxyz' ,
27
+ } ,
28
+ ] ,
27
29
} ) ;
28
30
const nullRes = Promise . resolve ( { } ) ;
29
31
@@ -35,18 +37,22 @@ test('Successfully GETs to metadata endpoint via issuer', async () => {
35
37
36
38
const result = await sdk . users . getMetadataByIssuer ( 'did:ethr:0x1234' ) ;
37
39
40
+ console . log ( result ) ;
41
+
38
42
const getArguments = getStub . mock . calls [ 0 ] ;
39
43
expect ( getArguments ) . toEqual ( [
40
44
'https://example.com/v1/admin/auth/user/get' ,
41
45
API_KEY ,
42
- { issuer : 'did:ethr:0x1234' , wallet_type : 'NONE' } ,
46
+ { issuer : 'did:ethr:0x1234' , wallet_type : 'NONE' } ,
43
47
] ) ;
48
+
44
49
expect ( result ) . toEqual ( {
45
50
issuer : 'foo' ,
46
51
publicAddress : 'bar' ,
47
52
email : 'baz' ,
48
53
oauthProvider : 'foo1' ,
49
54
phoneNumber : '+1234' ,
55
+ username : 'buzz' ,
50
56
wallets : null ,
51
57
} ) ;
52
58
} ) ;
@@ -71,6 +77,7 @@ test('Successfully GETs `null` metadata endpoint via issuer', async () => {
71
77
email : null ,
72
78
oauthProvider : null ,
73
79
phoneNumber : null ,
80
+ username : null ,
74
81
wallets : null ,
75
82
} ) ;
76
83
} ) ;
@@ -108,10 +115,13 @@ test('Successfully GETs to metadata endpoint via issuer and wallet type', async
108
115
email : 'baz' ,
109
116
oauthProvider : 'foo1' ,
110
117
phoneNumber : '+1234' ,
111
- wallets : [ {
112
- wallet_type : 'SOLANA' ,
113
- network : 'MAINNET' ,
114
- public_address : 'barxyz'
115
- } ] ,
118
+ username : 'buzz' ,
119
+ wallets : [
120
+ {
121
+ wallet_type : 'SOLANA' ,
122
+ network : 'MAINNET' ,
123
+ public_address : 'barxyz' ,
124
+ } ,
125
+ ] ,
116
126
} ) ;
117
- } ) ;
127
+ } ) ;
0 commit comments