Skip to content

Commit

Permalink
chore: add testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeseung-bae committed Mar 13, 2024
1 parent 9fc4f4e commit a0783c9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions x/collection/keeper/genesis_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package keeper_test

import (
"github.com/Finschia/finschia-sdk/types"
"github.com/Finschia/finschia-sdk/x/collection"
)

Expand Down Expand Up @@ -28,3 +29,17 @@ func (s *KeeperTestSuite) TestImportExportGenesis() {
newGenesis := s.keeper.ExportGenesis(s.ctx)
s.Require().Equal(genesis, newGenesis)
}

func (s *KeeperTestSuite) TestShouldPanicWhenZeroNextTokenIdInGenesis() {
dontCare := "12345678"
state := &collection.GenesisState{
Params: collection.Params{},
NextTokenIds: []collection.ContractNextTokenIDs{
{ContractId: dontCare, TokenIds: []collection.NextTokenID{
{ClassId: dontCare, Id: types.NewUint(0)},
}},
},
}

s.Require().Panics(func() { s.keeper.InitGenesis(s.ctx, state) })
}

0 comments on commit a0783c9

Please sign in to comment.