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 05be537
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
17 changes: 5 additions & 12 deletions flowkit/mocks/Services.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion internal/blocks/blocks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,27 @@ func Test_GetBlock(t *testing.T) {
assert.Equal(t, uint64(100), args.Get(3).(uint64))
}).Return(nil, nil)

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

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

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

srv.GetCollection.Return(returnCollection, nil)

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

0 comments on commit 05be537

Please sign in to comment.