2021-08-06 01:43:55 +00:00
|
|
|
package swap_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-05-01 03:17:24 +00:00
|
|
|
"github.com/0glabs/0g-chain/x/swap/testutil"
|
|
|
|
"github.com/0glabs/0g-chain/x/swap/types"
|
2021-08-06 01:43:55 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
|
2021-08-06 01:43:55 +00:00
|
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
)
|
|
|
|
|
|
|
|
type moduleTestSuite struct {
|
|
|
|
testutil.Suite
|
2022-01-08 00:39:27 +00:00
|
|
|
crisisKeeper crisiskeeper.Keeper
|
2021-08-06 01:43:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (suite *moduleTestSuite) SetupTest() {
|
|
|
|
suite.Suite.SetupTest()
|
|
|
|
suite.crisisKeeper = suite.App.GetCrisisKeeper()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (suite *moduleTestSuite) TestRegisterInvariants() {
|
|
|
|
swapRoutes := []string{}
|
|
|
|
|
|
|
|
for _, route := range suite.crisisKeeper.Routes() {
|
2022-01-08 00:39:27 +00:00
|
|
|
if route.ModuleName == types.ModuleName {
|
2021-08-06 01:43:55 +00:00
|
|
|
swapRoutes = append(swapRoutes, route.Route)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
suite.Contains(swapRoutes, "pool-records")
|
|
|
|
suite.Contains(swapRoutes, "share-records")
|
|
|
|
suite.Contains(swapRoutes, "pool-reserves")
|
|
|
|
suite.Contains(swapRoutes, "pool-shares")
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestModuleTestSuite(t *testing.T) {
|
|
|
|
suite.Run(t, new(moduleTestSuite))
|
|
|
|
}
|