@@ -25,64 +25,94 @@ describe('callEndpoint', () => {
2525
2626  it ( 'should accept a path param' ,  async  ( )  =>  { 
2727    await  expect ( 
28-       callEndpoint ( 'https://safe-client.staging.gnosisdev.com' ,  '/v1/chains/4/safe /{address}' ,  { 
29-         path : {  address : '0x123'  } , 
28+       callEndpoint ( 'https://safe-client.staging.gnosisdev.com' ,  '/v1/chains/{chainId}/safes /{address}' ,  { 
29+         path : {  chainId :  '4' ,   address : '0x123'  } , 
3030      } ) , 
3131    ) . resolves . toEqual ( {  success : true  } ) 
3232
3333    expect ( fetchData ) . toHaveBeenCalledWith ( 
34-       'https://safe-client.staging.gnosisdev.com/v1/chains/4/safe /0x123' , 
34+       'https://safe-client.staging.gnosisdev.com/v1/chains/4/safes /0x123' , 
3535      undefined , 
3636    ) 
3737  } ) 
3838
3939  it ( 'should accept several path params' ,  async  ( )  =>  { 
4040    await  expect ( 
41-       callEndpoint ( 'https://safe-client.staging.gnosisdev.com' ,  '/v1/chains/4/balances/{address}/{currency}' ,  { 
42-         path : {  address : '0x123' ,  currency : 'usd'  } , 
43-       } ) , 
41+       callEndpoint ( 
42+         'https://safe-client.staging.gnosisdev.com' , 
43+         '/v1/chains/{chainId}/safes/{address}/balances/{currency}' , 
44+         { 
45+           path : {  chainId : '4' ,  address : '0x123' ,  currency : 'usd'  } , 
46+           query : { } , 
47+         } , 
48+       ) , 
4449    ) . resolves . toEqual ( {  success : true  } ) 
4550
4651    expect ( fetchData ) . toHaveBeenCalledWith ( 
47-       'https://safe-client.staging.gnosisdev.com/v1/chains/4/balances /0x123/usd' , 
52+       'https://safe-client.staging.gnosisdev.com/v1/chains/4/safes /0x123/balances /usd' , 
4853      undefined , 
4954    ) 
5055  } ) 
5156
5257  it ( 'should accept query params' ,  async  ( )  =>  { 
5358    await  expect ( 
54-       callEndpoint ( 'https://safe-client.staging.gnosisdev.com' ,  '/v1/chains/4/balances/{address}/{currency}' ,  { 
55-         path : {  address : '0x123' ,  currency : 'usd'  } , 
56-         query : {  exclude_spam : true  } , 
57-       } ) , 
59+       callEndpoint ( 
60+         'https://safe-client.staging.gnosisdev.com' , 
61+         '/v1/chains/{chainId}/safes/{address}/balances/{currency}' , 
62+         { 
63+           path : {  chainId : '4' ,  address : '0x123' ,  currency : 'usd'  } , 
64+           query : {  exclude_spam : true  } , 
65+         } , 
66+       ) , 
5867    ) . resolves . toEqual ( {  success : true  } ) 
5968
6069    expect ( fetchData ) . toHaveBeenCalledWith ( 
61-       'https://safe-client.staging.gnosisdev.com/v1/chains/4/balances /0x123/usd?exclude_spam=true' , 
70+       'https://safe-client.staging.gnosisdev.com/v1/chains/4/safes /0x123/balances /usd?exclude_spam=true' , 
6271      undefined , 
6372    ) 
6473  } ) 
6574
6675  it ( 'should accept body' ,  async  ( )  =>  { 
76+     const  body  =  { 
77+       to : '0x123' , 
78+       value : 'test' , 
79+       data : null , 
80+       nonce : '1' , 
81+       operation : 1 , 
82+       safeTxGas : '' , 
83+       baseGas : '100' , 
84+       gasPrice : '1' , 
85+       gasToken : '' , 
86+       refundReceiver : null , 
87+       safeTxHash : '0x123' , 
88+       sender : '0x123' , 
89+       signature : null , 
90+       origin : null , 
91+     } 
92+ 
6793    await  expect ( 
68-       callEndpoint ( 'https://safe-client.staging.gnosisdev.com' ,  '/v1/chains/4/transactions/{safe_address}/propose' ,  { 
69-         path : {  safe_address : '0x123'  } , 
70-         body : {  test : 'test'  } , 
71-       } ) , 
94+       callEndpoint ( 
95+         'https://safe-client.staging.gnosisdev.com' , 
96+         '/v1/chains/{chainId}/transactions/{safe_address}/propose' , 
97+         { 
98+           path : {  chainId : '4' ,  safe_address : '0x123'  } , 
99+           body, 
100+         } , 
101+       ) , 
72102    ) . resolves . toEqual ( {  success : true  } ) 
73103
74104    expect ( fetchData ) . toHaveBeenCalledWith ( 
75105      'https://safe-client.staging.gnosisdev.com/v1/chains/4/transactions/0x123/propose' , 
76-       {   test :  'test'   } , 
106+       body , 
77107    ) 
78108  } ) 
79109
80110  it ( 'should accept a raw URL' ,  async  ( )  =>  { 
81111    await  expect ( 
82112      callEndpoint ( 
83113        'https://safe-client.staging.gnosisdev.com' , 
84-         '/v1/chains/4/balances /{address}/{currency}' , 
85-         {  path : {  address : '0x123' ,  currency : 'usd'  } ,  query : {  exclude_spam : true  }  } , 
114+         '/v1/chains/{chainId}/safes /{address}/balances /{currency}' , 
115+         {  path : {  chainId :  '4' ,   address : '0x123' ,  currency : 'usd'  } ,  query : {  exclude_spam : true  }  } , 
86116        '/test-url?raw=true' , 
87117      ) , 
88118    ) . resolves . toEqual ( {  success : true  } ) 
0 commit comments