Skip to content

Commit

Permalink
Added and improved tests of plan types
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrinivas8687 committed Jul 11, 2021
1 parent 1bc1af7 commit 26a7427
Show file tree
Hide file tree
Showing 3 changed files with 1,082 additions and 0 deletions.
45 changes: 45 additions & 0 deletions x/plan/types/genesis_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package types

import (
"testing"

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

func TestDefaultGenesisState(t *testing.T) {
var (
state GenesisState
)

state = DefaultGenesisState()
require.Equal(t, GenesisState(nil), state)
}

func TestNewGenesisState(t *testing.T) {
var (
plans GenesisPlans
state GenesisState
)

state = NewGenesisState(nil)
require.Nil(t, state)
require.Len(t, state, 0)

state = NewGenesisState(plans)
require.Equal(t, GenesisState(nil), state)
require.Len(t, state, 0)

plans = append(plans,
GenesisPlan{},
)
state = NewGenesisState(plans)
require.Equal(t, GenesisState(plans), state)
require.Len(t, state, 1)

plans = append(plans,
GenesisPlan{},
)
state = NewGenesisState(plans)
require.Equal(t, GenesisState(plans), state)
require.Len(t, state, 2)
}
Loading

0 comments on commit 26a7427

Please sign in to comment.