Skip to content

Commit

Permalink
fix(tests): fixed rewards tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RiccardoM committed Nov 12, 2024
1 parent 5e428ff commit 334f931
Show file tree
Hide file tree
Showing 16 changed files with 720 additions and 443 deletions.
313 changes: 0 additions & 313 deletions app/testutil/test_suite.go

This file was deleted.

6 changes: 5 additions & 1 deletion testutils/storetesting/keeper.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package storetesting

import (
"slices"
"testing"

"cosmossdk.io/log"
Expand Down Expand Up @@ -44,7 +45,10 @@ func NewBaseKeeperTestData(t *testing.T, keys []string) BaseKeeperTestData {
var data BaseKeeperTestData

// Define store keys
data.Keys = storetypes.NewKVStoreKeys(keys...)
storeKeys := append(keys, []string{authtypes.StoreKey, banktypes.StoreKey}...)

Check failure on line 48 in testutils/storetesting/keeper.go

View workflow job for this annotation

GitHub Actions / GolangCI

appendAssign: append result not assigned to the same slice (gocritic)
slices.Sort(storeKeys)
storeKeys = slices.Compact(storeKeys)
data.Keys = storetypes.NewKVStoreKeys(storeKeys...)

// Setup the context
data.Context = BuildContext(data.Keys, nil, nil)
Expand Down
6 changes: 3 additions & 3 deletions x/assets/keeper/assets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (suite *KeeperTestSuite) TestKeeper_SetAsset() {
suite.Run(tc.name, func() {
suite.SetupTest()

ctx, _ := suite.Ctx.CacheContext()
ctx, _ := suite.ctx.CacheContext()
if tc.store != nil {
tc.store(ctx)
}
Expand Down Expand Up @@ -91,7 +91,7 @@ func (suite *KeeperTestSuite) TestKeeper_GetAsset() {
suite.Run(tc.name, func() {
suite.SetupTest()

ctx, _ := suite.Ctx.CacheContext()
ctx, _ := suite.ctx.CacheContext()
if tc.store != nil {
tc.store(ctx)
}
Expand Down Expand Up @@ -139,7 +139,7 @@ func (suite *KeeperTestSuite) TestRemoveAsset() {
suite.Run(tc.name, func() {
suite.SetupTest()

ctx, _ := suite.Ctx.CacheContext()
ctx, _ := suite.ctx.CacheContext()
if tc.store != nil {
tc.store(ctx)
}
Expand Down
4 changes: 2 additions & 2 deletions x/assets/keeper/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (suite *KeeperTestSuite) TestExportGenesis() {
suite.Run(tc.name, func() {
suite.SetupTest()

ctx, _ := suite.Ctx.CacheContext()
ctx, _ := suite.ctx.CacheContext()
if tc.store != nil {
tc.store(ctx)
}
Expand Down Expand Up @@ -94,7 +94,7 @@ func (suite *KeeperTestSuite) TestInitGenesis() {
suite.Run(tc.name, func() {
suite.SetupTest()

ctx, _ := suite.Ctx.CacheContext()
ctx, _ := suite.ctx.CacheContext()
err := suite.keeper.InitGenesis(ctx, tc.genesis)
if tc.shouldErr {
suite.Require().Error(err)
Expand Down
4 changes: 2 additions & 2 deletions x/assets/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (suite *KeeperTestSuite) TestQuerier_Assets() {
suite.Run(tc.name, func() {
suite.SetupTest()

ctx, _ := suite.Ctx.CacheContext()
ctx, _ := suite.ctx.CacheContext()
if tc.store != nil {
tc.store(ctx)
}
Expand Down Expand Up @@ -140,7 +140,7 @@ func (suite *KeeperTestSuite) TestQuerier_Asset() {
suite.Run(tc.name, func() {
suite.SetupTest()

ctx, _ := suite.Ctx.CacheContext()
ctx, _ := suite.ctx.CacheContext()
if tc.store != nil {
tc.store(ctx)
}
Expand Down
Loading

0 comments on commit 334f931

Please sign in to comment.