Skip to content

Commit

Permalink
chore: add price generator test
Browse files Browse the repository at this point in the history
  • Loading branch information
freak12techno committed Jun 22, 2024
1 parent 4bb8f21 commit ab61fb2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/generators/balance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestBalanceGeneratorNoState(t *testing.T) {
assert.Empty(t, results)
}

func TestBlockSetValidators(t *testing.T) {
func TestBalanceGeneratorNotEmptyState(t *testing.T) {
t.Parallel()

state := statePkg.NewState()
Expand Down
36 changes: 36 additions & 0 deletions pkg/generators/price_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 TestPriceGeneratorNoState(t *testing.T) {
t.Parallel()

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

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

state := statePkg.NewState()
state.Set(constants.FetcherNamePrice, fetchers.PriceData{
Prices: map[string]map[string]float64{
"chain": {
"denom": 0.01,
},
},
})

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

0 comments on commit ab61fb2

Please sign in to comment.