-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update params * init test * partial update * cover params * minter * genesis * Update x/mint/types/params_test.go Co-authored-by: Lucas Bertrand <[email protected]> * fix * refactor minter validate test * refactor genesis test * refactor params test * refactor params test * refactor params test * refactor params test * add more test cases * make tests visual Co-authored-by: Lucas Bertrand <[email protected]>
- Loading branch information
Showing
9 changed files
with
572 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package types_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/ignite/modules/x/mint/types" | ||
) | ||
|
||
func TestValidateGenesis(t *testing.T) { | ||
invalid := types.DefaultGenesis() | ||
// set inflation min to larger than inflation max | ||
invalid.Params.InflationMin = invalid.Params.InflationMax.Add(invalid.Params.InflationMax) | ||
|
||
tests := []struct { | ||
name string | ||
genesis *types.GenesisState | ||
isValid bool | ||
}{ | ||
{ | ||
name: "should validate valid genesis", | ||
genesis: types.DefaultGenesis(), | ||
isValid: true, | ||
}, | ||
{ | ||
name: "should prevent invalid params", | ||
genesis: invalid, | ||
isValid: false, | ||
}, | ||
} | ||
for _, tc := range tests { | ||
t.Run(tc.name, func(t *testing.T) { | ||
err := tc.genesis.Validate() | ||
if !tc.isValid { | ||
require.Error(t, err) | ||
return | ||
} | ||
require.NoError(t, err) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.