Skip to content

Commit

Permalink
chore: add delegations generator test
Browse files Browse the repository at this point in the history
  • Loading branch information
freak12techno committed Jun 22, 2024
1 parent fb158d7 commit 2da7e04
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions pkg/generators/delegators_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package generators

import (
"main/pkg/constants"
"main/pkg/fetchers"
statePkg "main/pkg/state"
"testing"

"github.com/stretchr/testify/assert"
)

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

state := statePkg.NewState()
generator := NewDelegationsGenerator()
results := generator.Generate(state)
assert.Empty(t, results)
}

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

state := statePkg.NewState()
state.Set(constants.FetcherNameDelegations, fetchers.DelegationsData{
Delegations: map[string]map[string]uint64{
"chain": {
"validator": 100,
},
},
})

generator := NewDelegationsGenerator()
results := generator.Generate(state)
assert.NotEmpty(t, results)
}

0 comments on commit 2da7e04

Please sign in to comment.