2022-01-08 00:39:27 +00:00
|
|
|
package keeper_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
|
2024-05-01 03:17:24 +00:00
|
|
|
"github.com/0glabs/0g-chain/x/kavadist/testutil"
|
2022-01-08 00:39:27 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type keeperTestSuite struct {
|
|
|
|
testutil.Suite
|
|
|
|
}
|
|
|
|
|
|
|
|
func (suite *keeperTestSuite) SetupTest() {
|
|
|
|
suite.Suite.SetupTest()
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestKeeperTestSuite(t *testing.T) {
|
|
|
|
suite.Run(t, new(keeperTestSuite))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (suite *keeperTestSuite) TestSetAndGetPreviousBlockTime() {
|
|
|
|
newTime := time.Date(2020, time.March, 1, 1, 0, 0, 0, time.UTC)
|
|
|
|
suite.Keeper.SetPreviousBlockTime(suite.Ctx, newTime)
|
|
|
|
blockTime, found := suite.Keeper.GetPreviousBlockTime(suite.Ctx)
|
|
|
|
suite.Require().True(found)
|
|
|
|
suite.Require().Equal(newTime, blockTime)
|
|
|
|
}
|