Skip to content

Commit

Permalink
Fix failing tests for 'flow blocks get' command
Browse files Browse the repository at this point in the history
  • Loading branch information
m-Peter committed Jun 19, 2023
1 parent f6d6e43 commit 79f9aa3
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions internal/blocks/blocks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,31 @@ func Test_GetBlock(t *testing.T) {
assert.Equal(t, uint64(100), args.Get(3).(uint64))
}).Return(nil, nil)

srv.GetCollection.Return(nil, nil)

returnBlock := tests.NewBlock()
returnBlock.Height = uint64(100)

srv.GetBlock.Run(func(args mock.Arguments) {
assert.Equal(t, uint64(100), args.Get(1).(flowkit.BlockQuery).Height)
}).Return(returnBlock, nil)

returnCollection := tests.NewCollection()
transaction1 := tests.NewTransaction()
transaction2 := tests.NewTransaction()
returnCollection.TransactionIDs = []flow.Identifier{
transaction1.ID(),
transaction2.ID(),
}
transactions := []*flow.Transaction{
transaction1,
transaction2,
}

srv.GetTransactionsByBlockID.Run(func(args mock.Arguments) {
assert.Equal(t, returnBlock.ID, args.Get(1).(flow.Identifier))
}).Return(transactions, nil, nil)

srv.GetCollection.Return(returnCollection, nil)

result, err := get(inArgs, command.GlobalFlags{}, util.NoLogger, rw, srv.Mock)
assert.NotNil(t, result)
assert.NoError(t, err)
Expand Down

0 comments on commit 79f9aa3

Please sign in to comment.