From 3cec54f774ba0bc0d08717abe971a048e1ef38cc Mon Sep 17 00:00:00 2001 From: Phi Date: Wed, 9 Aug 2023 21:25:52 +0200 Subject: [PATCH] Make TestWalletBalance happy Set up an expected call to ChainHead --- cli/wallet_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cli/wallet_test.go b/cli/wallet_test.go index dee26018b..eb2c544f0 100644 --- a/cli/wallet_test.go +++ b/cli/wallet_test.go @@ -21,6 +21,7 @@ import ( "github.com/filecoin-project/lotus/api" apitypes "github.com/filecoin-project/lotus/api/types" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/lotus/chain/types/mock" ) func TestWalletNew(t *testing.T) { @@ -133,6 +134,11 @@ func TestWalletBalance(t *testing.T) { balance := big.NewInt(1234) + // add blocks to the chain + first := mock.TipSet(mock.MkBlock(nil, 5, 4)) + head := mock.TipSet(mock.MkBlock(first, 15, 7)) + + mockApi.EXPECT().ChainHead(ctx).Return(head, nil) mockApi.EXPECT().WalletBalance(ctx, addr).Return(balance, nil) //stm: @CLI_WALLET_BALANCE_001