internal/ethapi, signer/core/apitypes: updates to tests

This commit is contained in:
Martin Holst Swende 2024-03-08 16:07:26 +01:00
parent 8a35841765
commit bcd9790781
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0
2 changed files with 8 additions and 7 deletions

View file

@ -1037,11 +1037,8 @@ func TestSignBlobTransaction(t *testing.T) {
} }
_, err = api.SignTransaction(context.Background(), argsFromTransaction(res.Tx, b.acc.Address)) _, err = api.SignTransaction(context.Background(), argsFromTransaction(res.Tx, b.acc.Address))
if err == nil { if err != nil {
t.Fatalf("should fail on blob transaction") t.Fatalf("should not fail on blob transaction")
}
if !errors.Is(err, errBlobTxNotSupported) {
t.Errorf("error mismatch. Have: %v, want: %v", err, errBlobTxNotSupported)
} }
} }

View file

@ -72,10 +72,14 @@ func TestTxArgs(t *testing.T) {
if err := json.Unmarshal(tc.data, &txArgs); err != nil { if err := json.Unmarshal(tc.data, &txArgs); err != nil {
t.Fatal(err) t.Fatal(err)
} }
if have := txArgs.ToTransaction().Type(); have != tc.wantType { tx, err := txArgs.ToTransaction()
if err != nil {
t.Fatal(err)
}
if have := tx.Type(); have != tc.wantType {
t.Errorf("test %d, have type %d, want type %d", i, have, tc.wantType) t.Errorf("test %d, have type %d, want type %d", i, have, tc.wantType)
} }
if have := txArgs.ToTransaction().Hash(); have != tc.want { if have := tx.Hash(); have != tc.want {
t.Errorf("test %d: have %v, want %v", i, have, tc.want) t.Errorf("test %d: have %v, want %v", i, have, tc.want)
} }
d2, err := json.Marshal(txArgs) d2, err := json.Marshal(txArgs)