Skip to content

Commit

Permalink
Test for Zone (quicksilver-zone#682)
Browse files Browse the repository at this point in the history
* Test for Zone

* lint

* minor fix

* minor fix follow nhan

---------

Co-authored-by: Nguyen Thanh Nhan <[email protected]>
  • Loading branch information
DongLieu and ThanhNhann authored Oct 13, 2023
1 parent ba00077 commit d786e8b
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions x/interchainstaking/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1302,3 +1302,50 @@ func (suite *KeeperTestSuite) TestKeeper_MappedAccounts() {
})
}
}

func (suite *KeeperTestSuite) TestKeeper_Zone() {
testCases := []struct {
name string
malleate func()
req *types.QueryZoneRequest
wantErr bool
}{
{
name: "empty request",
malleate: func() {},
req: nil,
wantErr: true,
},
{
name: "zone not found",
malleate: func() {},
req: &types.QueryZoneRequest{ChainId: suite.chainB.ChainID},
wantErr: true,
},
{
name: "zone valid request",
malleate: func() {
suite.SetupTest()
suite.setupTestZones()
},
req: &types.QueryZoneRequest{ChainId: suite.chainB.ChainID},
wantErr: false,
},
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
tc.malleate()
icsKeeper := suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper
ctx := suite.chainA.GetContext()

resp, err := icsKeeper.Zone(ctx, tc.req)
if tc.wantErr {
suite.T().Logf("Error:\n%v\n", err)
suite.Error(err)
} else {
suite.NoError(err)
suite.NotNil(resp)
}
})
}
}

0 comments on commit d786e8b

Please sign in to comment.