Skip to content

Commit

Permalink
chore: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
freak12techno committed Dec 21, 2023
1 parent 8607d9d commit d3628ff
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions pkg/types/params_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package types

import (
"testing"

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

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

params := ChainWithVotingParams{
Quorum: 0.4,
}

assert.Equal(t, "40.00%", params.FormatQuorum(), "Wrong value!")
}

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

params := ChainWithVotingParams{
Threshold: 0.4,
}

assert.Equal(t, "40.00%", params.FormatThreshold(), "Wrong value!")
}

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

params := ChainWithVotingParams{
VetoThreshold: 0.4,
}

assert.Equal(t, "40.00%", params.FormatVetoThreshold(), "Wrong value!")
}

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

params := ChainWithVotingParams{
MinDepositAmount: []Amount{
{Denom: "stake", Amount: "100"},
{Denom: "test", Amount: "100"},
},
}

assert.Equal(t, "100 stake,100 test", params.FormatMinDepositAmount(), "Wrong value!")
}

0 comments on commit d3628ff

Please sign in to comment.