@@ -3,7 +3,6 @@ package mempool
3
3
import (
4
4
"bytes"
5
5
"context"
6
- "encoding/json"
7
6
"errors"
8
7
"fmt"
9
8
"math/rand"
@@ -707,24 +706,17 @@ func TestAppendCheckTxErr(t *testing.T) {
707
706
}
708
707
t .Cleanup (client .Wait )
709
708
txmp := setup (t , client , 500 )
710
- existingData := `[{"log":"existing error log"}]`
709
+ existingLogData := "existing error log"
710
+ newLogData := "sample error log"
711
711
712
712
// Append new error
713
- result := txmp .AppendCheckTxErr (existingData , "sample error msg" )
713
+ actualResult := txmp .AppendCheckTxErr (existingLogData , newLogData )
714
+ expectedResult := fmt .Sprintf ("%s; %s" , existingLogData , newLogData )
714
715
715
- // Unmarshal the result
716
- var data []map [string ]interface {}
717
- err := json .Unmarshal ([]byte (result ), & data )
718
- require .NoError (t , err )
719
- require .Equal (t , len (data ), 2 )
720
- require .Equal (t , data [1 ]["log" ], "sample error msg" )
716
+ require .Equal (t , expectedResult , actualResult )
721
717
722
718
// Append new error to empty log
723
- result = txmp .AppendCheckTxErr ("" , "sample error msg" )
719
+ actualResult = txmp .AppendCheckTxErr ("" , newLogData )
724
720
725
- // Unmarshal the result
726
- err = json .Unmarshal ([]byte (result ), & data )
727
- require .NoError (t , err )
728
- require .Equal (t , len (data ), 1 )
729
- require .Equal (t , data [0 ]["log" ], "sample error msg" )
730
- }
721
+ require .Equal (t , newLogData , actualResult )
722
+ }
0 commit comments