Skip to content

Commit

Permalink
chore: add tests for Entry
Browse files Browse the repository at this point in the history
  • Loading branch information
freak12techno committed Jun 13, 2024
1 parent 35823be commit 70bb1a1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/types/entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,16 @@ func TestEntriesSetTotalVotingPower(t *testing.T) {
assert.InDelta(t, float64(1), entries["firstaddr"].CumulativeVotingPowerPercent, 0.001)
assert.InDelta(t, 0.75, entries["secondaddr"].CumulativeVotingPowerPercent, 0.001)
}

func TestEntriesGetByValidatorAddresses(t *testing.T) {
t.Parallel()

entries := Entries{
"firstaddr": {Validator: &Validator{OperatorAddress: "firstaddr"}},
"secondaddr": {Validator: &Validator{OperatorAddress: "secondaddr"}},
"thirdaddr": {Validator: &Validator{OperatorAddress: "thirdaddr"}},
}

filteredEntries := entries.ByValidatorAddresses([]string{"firstaddr", "secondaddr"})
assert.Len(t, filteredEntries, 2)
}

0 comments on commit 70bb1a1

Please sign in to comment.