@@ -42,7 +42,9 @@ func (s *SigningHandlerTestSuite) Test_HandleSigning_MissingDepositID() {
4242 handler := handlers .NewSigningHandler (msgChn , s .chains )
4343
4444 input := handlers.SigningBody {
45- Protocol : "across" ,
45+ Protocol : "across" ,
46+ LiquidityPool : "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657" ,
47+ Caller : "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657" ,
4648 }
4749 body , _ := json .Marshal (input )
4850
@@ -65,13 +67,75 @@ func (s *SigningHandlerTestSuite) Test_HandleSigning_MissingDepositID() {
6567 s .Equal (http .StatusBadRequest , recorder .Code )
6668}
6769
68- func (s * SigningHandlerTestSuite ) Test_HandleSigning_InvalidChainID () {
70+ func (s * SigningHandlerTestSuite ) Test_HandleSigning_MissingCaller () {
71+ msgChn := make (chan []* message.Message )
72+ handler := handlers .NewSigningHandler (msgChn , s .chains )
73+
74+ input := handlers.SigningBody {
75+ Protocol : "across" ,
76+ DepositId : & handlers.BigInt {big .NewInt (1000 )},
77+ LiquidityPool : "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657" ,
78+ }
79+ body , _ := json .Marshal (input )
80+
81+ req := httptest .NewRequest (http .MethodPost , "/v1/chains/1/signatures" , bytes .NewReader (body ))
82+ req .Header .Set ("Content-Type" , "application/json" )
83+ req = mux .SetURLVars (req , map [string ]string {
84+ "chainId" : "1" ,
85+ })
86+
87+ recorder := httptest .NewRecorder ()
88+
89+ go func () {
90+ msg := <- msgChn
91+ ad := msg [0 ].Data .(across.AcrossData )
92+ ad .ErrChn <- fmt .Errorf ("error handling message" )
93+ }()
94+
95+ handler .HandleSigning (recorder , req )
96+
97+ s .Equal (http .StatusBadRequest , recorder .Code )
98+ }
99+
100+ func (s * SigningHandlerTestSuite ) Test_HandleSigning_MissingLiquidityPool () {
69101 msgChn := make (chan []* message.Message )
70102 handler := handlers .NewSigningHandler (msgChn , s .chains )
71103
72104 input := handlers.SigningBody {
73- DepositId : & handlers.BigInt {big .NewInt (1000 )},
74105 Protocol : "across" ,
106+ DepositId : & handlers.BigInt {big .NewInt (1000 )},
107+ Caller : "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657" ,
108+ }
109+ body , _ := json .Marshal (input )
110+
111+ req := httptest .NewRequest (http .MethodPost , "/v1/chains/1/signatures" , bytes .NewReader (body ))
112+ req .Header .Set ("Content-Type" , "application/json" )
113+ req = mux .SetURLVars (req , map [string ]string {
114+ "chainId" : "1" ,
115+ })
116+
117+ recorder := httptest .NewRecorder ()
118+
119+ go func () {
120+ msg := <- msgChn
121+ ad := msg [0 ].Data .(across.AcrossData )
122+ ad .ErrChn <- fmt .Errorf ("error handling message" )
123+ }()
124+
125+ handler .HandleSigning (recorder , req )
126+
127+ s .Equal (http .StatusBadRequest , recorder .Code )
128+ }
129+
130+ func (s * SigningHandlerTestSuite ) Test_HandleSigning_InvalidChainID () {
131+ msgChn := make (chan []* message.Message )
132+ handler := handlers .NewSigningHandler (msgChn , s .chains )
133+
134+ input := handlers.SigningBody {
135+ DepositId : & handlers.BigInt {big .NewInt (1000 )},
136+ Protocol : "across" ,
137+ LiquidityPool : "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657" ,
138+ Caller : "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657" ,
75139 }
76140 body , _ := json .Marshal (input )
77141
@@ -99,8 +163,10 @@ func (s *SigningHandlerTestSuite) Test_HandleSigning_ChainNotSupported() {
99163 handler := handlers .NewSigningHandler (msgChn , s .chains )
100164
101165 input := handlers.SigningBody {
102- DepositId : & handlers.BigInt {big .NewInt (1000 )},
103- Protocol : "across" ,
166+ DepositId : & handlers.BigInt {big .NewInt (1000 )},
167+ Protocol : "across" ,
168+ LiquidityPool : "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657" ,
169+ Caller : "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657" ,
104170 }
105171 body , _ := json .Marshal (input )
106172
@@ -128,8 +194,10 @@ func (s *SigningHandlerTestSuite) Test_HandleSigning_InvalidProtocol() {
128194 handler := handlers .NewSigningHandler (msgChn , s .chains )
129195
130196 input := handlers.SigningBody {
131- DepositId : & handlers.BigInt {big .NewInt (1000 )},
132- Protocol : "invalid" ,
197+ DepositId : & handlers.BigInt {big .NewInt (1000 )},
198+ Protocol : "invalid" ,
199+ LiquidityPool : "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657" ,
200+ Caller : "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657" ,
133201 }
134202 body , _ := json .Marshal (input )
135203
@@ -157,8 +225,10 @@ func (s *SigningHandlerTestSuite) Test_HandleSigning_ErrorHandlingMessage() {
157225 handler := handlers .NewSigningHandler (msgChn , s .chains )
158226
159227 input := handlers.SigningBody {
160- DepositId : & handlers.BigInt {big .NewInt (1000 )},
161- Protocol : "across" ,
228+ DepositId : & handlers.BigInt {big .NewInt (1000 )},
229+ Protocol : "across" ,
230+ LiquidityPool : "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657" ,
231+ Caller : "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657" ,
162232 }
163233 body , _ := json .Marshal (input )
164234
@@ -186,8 +256,10 @@ func (s *SigningHandlerTestSuite) Test_HandleSigning_Success() {
186256 handler := handlers .NewSigningHandler (msgChn , s .chains )
187257
188258 input := handlers.SigningBody {
189- DepositId : & handlers.BigInt {big .NewInt (1000 )},
190- Protocol : "across" ,
259+ DepositId : & handlers.BigInt {big .NewInt (1000 )},
260+ Protocol : "across" ,
261+ LiquidityPool : "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657" ,
262+ Caller : "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657" ,
191263 }
192264 body , _ := json .Marshal (input )
193265
0 commit comments