Skip to content

Commit

Permalink
Pass expected error as second argument to ErrorIs. (cosmos#5712)
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim authored Jan 24, 2024
1 parent 2f3fa4b commit 65306ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions modules/apps/callbacks/ibc_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (s *CallbacksTestSuite) TestSendPacket() {

default:
sendPacket()
s.Require().ErrorIs(tc.expValue.(error), err)
s.Require().ErrorIs(err, tc.expValue.(error))
s.Require().Equal(uint64(0), seq)
}

Expand Down Expand Up @@ -344,7 +344,7 @@ func (s *CallbacksTestSuite) TestOnAcknowledgementPacket() {

default:
err := onAcknowledgementPacket()
s.Require().ErrorIs(tc.expError, err)
s.Require().ErrorIs(err, tc.expError)
}

sourceStatefulCounter := GetSimApp(s.chainA).MockContractKeeper.GetStateEntryCounter(s.chainA.GetContext())
Expand Down Expand Up @@ -499,7 +499,7 @@ func (s *CallbacksTestSuite) TestOnTimeoutPacket() {
s.Require().Nil(err)
case error:
err := onTimeoutPacket()
s.Require().ErrorIs(expValue, err)
s.Require().ErrorIs(err, expValue)
default:
s.Require().PanicsWithValue(tc.expValue, func() {
_ = onTimeoutPacket()
Expand Down Expand Up @@ -792,7 +792,7 @@ func (s *CallbacksTestSuite) TestWriteAcknowledgement() {
}

} else {
s.Require().ErrorIs(tc.expError, err)
s.Require().ErrorIs(err, tc.expError)
}
})
}
Expand Down Expand Up @@ -933,7 +933,7 @@ func (s *CallbacksTestSuite) TestProcessCallback() {
s.Require().PanicsWithValue(tc.expValue, processCallback)
default:
processCallback()
s.Require().ErrorIs(tc.expValue.(error), err)
s.Require().ErrorIs(err, tc.expValue.(error))
}

s.Require().Equal(expGasConsumed, ctx.GasMeter().GasConsumed())
Expand Down Expand Up @@ -992,7 +992,7 @@ func (s *CallbacksTestSuite) TestOnChanCloseInit() {
controllerStack := icaControllerStack.(porttypes.Middleware)
err := controllerStack.OnChanCloseInit(s.chainA.GetContext(), s.path.EndpointA.ChannelConfig.PortID, s.path.EndpointA.ChannelID)
// we just check that this call is passed down to the icacontroller to return an error
s.Require().ErrorIs(errorsmod.Wrap(ibcerrors.ErrInvalidRequest, "user cannot close channel"), err)
s.Require().ErrorIs(err, errorsmod.Wrap(ibcerrors.ErrInvalidRequest, "user cannot close channel"))
}

func (s *CallbacksTestSuite) TestOnChanCloseConfirm() {
Expand Down
2 changes: 1 addition & 1 deletion modules/core/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2771,7 +2771,7 @@ func (suite *KeeperTestSuite) TestUpdateChannelParams() {
suite.Require().Equal(tc.msg.Params, p)
} else {
suite.Require().Nil(resp)
suite.Require().ErrorIs(tc.expError, err)
suite.Require().ErrorIs(err, tc.expError)
}
})
}
Expand Down

0 comments on commit 65306ac

Please sign in to comment.