Skip to content

Commit

Permalink
fix genesis unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani committed Jul 31, 2024
1 parent 950ced6 commit 039fb1e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion x/claim/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ import (
"fmt"

sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
)

const DefaultIndex uint64 = 1

// DefaultGenesis returns the default genesis state
func DefaultGenesis() *GenesisState {
return &GenesisState{
AirdropSupply: AirdropSupply{Supply: sdk.NewCoin("utest", sdkmath.ZeroInt())},
ClaimRecordList: []ClaimRecord{},
MissionList: []Mission{},
InitialClaim: InitialClaim{},
AirdropSupply: AirdropSupply{},
// this line is used by starport scaffolding # genesis/types/default
Params: DefaultParams(),
}
Expand Down
17 changes: 17 additions & 0 deletions x/claim/types/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: fiftyPercent,
},
},
MissionCount: 2,
AirdropSupply: types.AirdropSupply{Supply: sdk.NewCoin("foo", claimAmts[0].Add(claimAmts[1]))},
InitialClaim: types.InitialClaim{
Enabled: false,
Expand All @@ -75,6 +76,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: sdkmath.LegacyOneDec(),
},
},
MissionCount: 1,
AirdropSupply: types.AirdropSupply{Supply: tc.Coin(t, "0foo")},
},
valid: true,
Expand Down Expand Up @@ -121,6 +123,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: sdkmath.LegacyZeroDec(),
},
},
MissionCount: 2,
AirdropSupply: types.AirdropSupply{Supply: tc.Coin(t, "20foo")},
},
valid: true,
Expand Down Expand Up @@ -151,6 +154,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: tc.Dec(t, "0.6"),
},
},
MissionCount: 2,
AirdropSupply: types.AirdropSupply{Supply: tc.Coin(t, "10foo")},
},
valid: true,
Expand Down Expand Up @@ -181,6 +185,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: tc.Dec(t, "0.6"),
},
},
MissionCount: 2,
AirdropSupply: types.AirdropSupply{Supply: tc.Coin(t, "6foo")},
},
valid: true,
Expand Down Expand Up @@ -211,6 +216,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: sdkmath.LegacyZeroDec(),
},
},
MissionCount: 2,
AirdropSupply: types.AirdropSupply{Supply: tc.Coin(t, "20foo")},
},
valid: true,
Expand All @@ -235,6 +241,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: sdkmath.LegacyOneDec(),
},
},
MissionCount: 1,
AirdropSupply: types.AirdropSupply{Supply: tc.Coin(t, "20foo")},
InitialClaim: types.InitialClaim{
Enabled: true,
Expand Down Expand Up @@ -263,6 +270,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: sdkmath.LegacyOneDec(),
},
},
MissionCount: 1,
AirdropSupply: types.AirdropSupply{Supply: tc.Coin(t, "20foo")},
},
valid: false,
Expand All @@ -287,6 +295,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: sdkmath.LegacyOneDec(),
},
},
MissionCount: 1,
AirdropSupply: types.AirdropSupply{Supply: tc.Coin(t, "20foo")},
},
valid: false,
Expand All @@ -312,6 +321,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: sdkmath.LegacyOneDec(),
},
},
MissionCount: 1,
},
valid: false,
},
Expand All @@ -336,6 +346,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: sdkmath.LegacyOneDec(),
},
},
MissionCount: 1,
},
valid: false,
},
Expand Down Expand Up @@ -364,6 +375,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: tc.Dec(t, "0.6"),
},
},
MissionCount: 2,
AirdropSupply: types.AirdropSupply{Supply: tc.Coin(t, "20foo")},
},
valid: false,
Expand All @@ -389,6 +401,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: sdkmath.LegacyOneDec(),
},
},
MissionCount: 1,
AirdropSupply: types.AirdropSupply{Supply: tc.Coin(t, "20foo")},
},
valid: false,
Expand All @@ -404,6 +417,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: sdkmath.LegacyOneDec(),
},
},
MissionCount: 1,
},
valid: false,
},
Expand All @@ -421,6 +435,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: fiftyPercent,
},
},
MissionCount: 2,
},
valid: false,
},
Expand All @@ -438,6 +453,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: sdkmath.LegacyZeroDec(),
},
},
MissionCount: 2,
},
valid: false,
},
Expand Down Expand Up @@ -477,6 +493,7 @@ func TestGenesisState_Validate(t *testing.T) {
Weight: sdkmath.LegacyOneDec(),
},
},
MissionCount: 1,
AirdropSupply: types.AirdropSupply{Supply: tc.Coin(t, "0foo")},
},
valid: false,
Expand Down

0 comments on commit 039fb1e

Please sign in to comment.