Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani committed Oct 24, 2024
1 parent 584d899 commit 6866069
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/static/openapi.yml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions x/fundraising/keeper/auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ func (k Keeper) CreateFixedPriceAuction(ctx context.Context, msg *types.MsgCreat
sdkCtx := sdk.UnwrapSDKContext(ctx)
blockTime := sdkCtx.BlockTime()
if blockTime.After(msg.EndTime) { // EndTime < CurrentTime
return nil, sdkerrors.Wrapf(errors.ErrInvalidRequest, "end time (%d) must be set after the current time (%d)", msg.EndTime.Unix(), blockTime.Unix())
return nil, sdkerrors.Wrapf(errors.ErrInvalidRequest, "end time (%d) must be set after the current time", msg.EndTime.Unix())
}

if len(msg.VestingSchedules) > types.MaxNumVestingSchedules {
Expand Down Expand Up @@ -526,7 +526,7 @@ func (k Keeper) CreateBatchAuction(ctx context.Context, msg *types.MsgCreateBatc
sdkCtx := sdk.UnwrapSDKContext(ctx)
blockTime := sdkCtx.BlockTime()
if blockTime.After(msg.EndTime) { // EndTime < CurrentTime
return nil, sdkerrors.Wrapf(errors.ErrInvalidRequest, "end time (%d) must be set after the current time (%d)", msg.EndTime.Unix(), blockTime.Unix())
return nil, sdkerrors.Wrapf(errors.ErrInvalidRequest, "end time (%d) must be set after the current time", msg.EndTime.Unix())
}

if len(msg.VestingSchedules) > types.MaxNumVestingSchedules {
Expand Down
10 changes: 6 additions & 4 deletions x/fundraising/keeper/auction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,19 +475,21 @@ func (s *KeeperTestSuite) TestInvalidEndTime() {
params, err := s.keeper.Params.Get(s.ctx)
s.Require().NoError(err)

startTime := types.MustParseRFC3339("2022-03-01T00:00:00Z")
endTime := types.MustParseRFC3339("2022-01-01T00:00:00Z")
fixedPriceAuction := types.NewMsgCreateFixedPriceAuction(
s.addr(0).String(),
parseDec("0.5"),
parseCoin("500_000_000_000denom1"),
"denom2",
[]types.VestingSchedule{},
types.MustParseRFC3339("2022-03-01T00:00:00Z"),
types.MustParseRFC3339("2022-01-01T00:00:00Z"),
startTime,
endTime,
)
s.fundAddr(s.addr(0), params.AuctionCreationFee.Add(fixedPriceAuction.SellingCoin))

_, err = s.keeper.CreateFixedPriceAuction(s.ctx, fixedPriceAuction)
s.Require().EqualError(err, sdkerrors.Wrap(errors.ErrInvalidRequest, "end time must be set after the current time").Error())
s.Require().EqualError(err, sdkerrors.Wrapf(errors.ErrInvalidRequest, "end time (%d) must be set after the current time", endTime.Unix()).Error())

batchAuction := types.NewMsgCreateBatchAuction(
s.addr(1).String(),
Expand All @@ -504,7 +506,7 @@ func (s *KeeperTestSuite) TestInvalidEndTime() {
s.fundAddr(s.addr(1), params.AuctionCreationFee.Add(batchAuction.SellingCoin))

_, err = s.keeper.CreateBatchAuction(s.ctx, batchAuction)
s.Require().EqualError(err, sdkerrors.Wrap(errors.ErrInvalidRequest, "end time must be set after the current time").Error())
s.Require().EqualError(err, sdkerrors.Wrapf(errors.ErrInvalidRequest, "end time (%d) must be set after the current time", endTime.Unix()).Error())
}

func (s *KeeperTestSuite) TestAddAllowedBidders() {
Expand Down

0 comments on commit 6866069

Please sign in to comment.