diff --git a/pkg/rpc/mock.go b/pkg/rpc/mock.go index 085543c..2b061c8 100644 --- a/pkg/rpc/mock.go +++ b/pkg/rpc/mock.go @@ -168,7 +168,6 @@ func (s *MockServer) getResult(method string, params ...any) (any, *RPCError) { rewards := make([]map[string]int, len(addresses)) for i, item := range addresses { address := item.(string) - // TODO: make inflation rewards fetchable by epoch rewards[i] = map[string]int{"amount": s.inflationRewards[address], "epoch": epoch} } return rewards, nil diff --git a/pkg/rpc/mock_test.go b/pkg/rpc/mock_test.go index 5aa0b92..cebd31f 100644 --- a/pkg/rpc/mock_test.go +++ b/pkg/rpc/mock_test.go @@ -3,6 +3,7 @@ package rpc import ( "context" "github.com/stretchr/testify/assert" + "sort" "testing" ) @@ -130,7 +131,10 @@ func TestMockServer_getVoteAccounts(t *testing.T) { voteAccounts, err := client.GetVoteAccounts(ctx, CommitmentFinalized) assert.NoError(t, err) - // TODO: this test sometimes (albeit rarely) fails because the ordering gets mixed up, fix! + // sort the vote accounts before comparing: + sort.Slice(voteAccounts.Current, func(i, j int) bool { + return voteAccounts.Current[i].VotePubkey < voteAccounts.Current[j].VotePubkey + }) assert.Equal(t, VoteAccounts{ Current: []VoteAccount{