You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The cli tests assertions can be improved. We have this pattern all throughout our code and would be nice to have it all cleaned up at once to have consistency and a proper example to base new tests off of.
1.) We have an expectedErr bool. This should be a string and and checked with EqualError call.
2.) Don't need the respType property, because the response is always sdk.TxResponse
3.) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) Fix output message.
4.) Change expected code checks to int32 instead of uint32 and add output message.
Problem Definition
Proposal
For Admin Use
Not duplicate issue
Appropriate labels applied
Appropriate contributors tagged
Contributor assigned/self-assigned
The text was updated successfully, but these errors were encountered:
The out variable there (1st returned variable from ExecTestCLICmd) is a buffer, and calling either Bytes() or String() on it might clear it out so that the next time one of those are called, it returns empty. So it's better to call one of those and store it in a variable for use down the road. It's an easy cast to go between the two string and []byte types later.
We now have the TxExecutor (defined in testutil/cli/exec.go) that we should consider switching to for these tests.
Summary
The cli tests assertions can be improved. We have this pattern all throughout our code and would be nice to have it all cleaned up at once to have consistency and a proper example to base new tests off of.
A few things:
1.) We have an
expectedErr
bool. This should be a string and and checked with EqualError call.2.) Don't need the
respType
property, because the response is alwayssdk.TxResponse
3.)
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String())
Fix output message.4.) Change expected code checks to int32 instead of uint32 and add output message.
Problem Definition
Proposal
For Admin Use
The text was updated successfully, but these errors were encountered: