0g-chain/x/kavadist/keeper/keeper_test.go

31 lines
667 B
Go
Raw Normal View History

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"
)
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)
}