@@ -118,8 +118,8 @@ func TestDoSignAndPost_AutoSign_Success(t *testing.T) {
118118
119119 autoSign = true
120120 signerAddress = "addr_A"
121- _ , rawPriv , _ := ed25519 .GenerateKey (nil )
122121
122+ pubKey , rawPriv , _ := ed25519 .GenerateKey (nil )
123123 privateKey = & mock.PrivateKeyMock {
124124 ScalarMock : func () crypto.Scalar {
125125 return & mock.ScalarMock {
@@ -129,22 +129,35 @@ func TestDoSignAndPost_AutoSign_Success(t *testing.T) {
129129 }
130130 },
131131 }
132+
133+ expectedAddress := walletPubKeyConverter .Encode (pubKey )
134+
135+ var capturedBody MSApiEncoded
132136 srv := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
137+ require .NoError (t , json .NewDecoder (r .Body ).Decode (& capturedBody ))
133138 w .Header ().Set ("Content-Type" , "application/json" )
134139 _ = json .NewEncoder (w ).Encode (map [string ]string {"status" : "ok" , "error" : "" })
135140 }))
136141 defer srv .Close ()
137142 multisignAPI = srv .URL
143+
138144 tx := & MSApiTransaction {
139145 Hash : validHash ,
140146 Signers : []MSApiSigner {{Address : "addr_A" , Signed : false }},
141147 Raw : & transaction.Transaction {
142148 Signature : make ([][]byte , 0 ),
143- RawData : & transaction.Transaction_Raw {},
149+ RawData : & transaction.Transaction_Raw {
150+ Sender : pubKey ,
151+ },
144152 },
145153 }
154+
146155 err := doSignAndPost (tx )
147156 assert .NoError (t , err )
157+
158+ assert .Equal (t , expectedAddress , capturedBody .Address , "posted address should be the bech32-encoded sender pubkey" )
159+ assert .Len (t , tx .Raw .Signature , 1 , "a signature should have been appended to the transaction" )
160+ assert .NotEmpty (t , tx .Raw .Signature [0 ], "appended signature should not be empty" )
148161}
149162
150163// --- doPostMSTransactionSignature ---
0 commit comments