Skip to content

Commit

Permalink
Fix VM-With-Contracts Unit Tests (#1602)
Browse files Browse the repository at this point in the history
  • Loading branch information
RodrigoVillar authored Oct 1, 2024
1 parent 8ab9d83 commit c24f0d8
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions examples/vmwithcontracts/actions/transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ func TestTransferAction(t *testing.T) {
Value: 1,
},
State: func() state.Mutable {
keys := make(state.Keys)
keys.Add(string(emptyBalanceKey), state.Read)
tsv := ts.NewView(keys, map[string][]byte{})
return tsv
s := chaintest.NewInMemoryStore()
_, err := storage.AddBalance(
context.Background(),
s,
codec.EmptyAddress,
0,
true,
)
require.NoError(t, err)
return s
}(),
ExpectedErr: storage.ErrInvalidBalance,
},
Expand All @@ -79,6 +85,10 @@ func TestTransferAction(t *testing.T) {
require.NoError(err)
require.Equal(balance, uint64(1))
},
ExpectedOutputs: &TransferResult{
SenderBalance: 0,
ReceiverBalance: 1,
},
},
{
Name: "OverflowBalance",
Expand Down Expand Up @@ -120,6 +130,10 @@ func TestTransferAction(t *testing.T) {
require.NoError(err)
require.Equal(senderBalance, uint64(0))
},
ExpectedOutputs: &TransferResult{
SenderBalance: 0,
ReceiverBalance: 1,
},
},
}

Expand Down

0 comments on commit c24f0d8

Please sign in to comment.