-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: adding Sanitize()
method to Data
interface
#168
Conversation
Coverage after merging 0xankit/decDatafixes into master
Coverage Report
|
Coverage after merging 0xankit/decDatafixes into master
Coverage Report
|
compare
method of decDataSanitize()
method to Data
interface
Sanitize()
method to Data
interfaceSanitize()
method to Data
interface
Coverage after merging 0xankit/decDatafixes into master
Coverage Report
|
Coverage after merging 0xankit/decDatafixes into master
Coverage Report
|
Coverage after merging 0xankit/decDatafixes into master
Coverage Report
|
Coverage after merging 0xankit/decDatafixes into master
Coverage Report
|
Coverage after merging 0xankit/decDatafixes into master
Coverage Report
|
Coverage after merging 0xankit/decDatafixes into master
Coverage Report
|
@@ -60,6 +70,13 @@ func (decData decData) Get() sdkTypes.Dec { | |||
return decData.Value | |||
} | |||
|
|||
func (decData decData) Sanitize() (data.Data, error) { | |||
if decData.Value.Int == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that there is no reference for Int in my cosmos-sdk version, can you please test this, The only option I can find is BigInt()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Int is being used as anonymous field here which is of the type big.Int. BigInt() is a method but we needed to check the value here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is relevant unit tests:
modules/schema/data/base/decData_test.go
Lines 113 to 118 in 3eb6751
{"+ve with nil", fields{}, args{decData{}}, 0}, | |
{"+ve with nil", fields{types.Dec{}}, args{decData{types.Dec{}}}, 0}, | |
{"+ve with zero dec", fields{types.ZeroDec()}, args{decData{types.ZeroDec()}}, 0}, | |
{"+ve", fields{types.NewDec(100)}, args{decData{types.NewDec(100)}}, 0}, | |
{"-ve", fields{types.NewDec(-100)}, args{decData{types.NewDec(100)}}, -1}, | |
{"+ve with -ve Dec", fields{types.NewDec(-100)}, args{decData{types.NewDec(-100)}}, 0}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
Add tests for schema Newly Added Files
…le/modules into 0xankit/decDatafixes
… into 0xankit/decDatafixes
… into 0xankit/decDatafixes
SonarCloud Quality Gate failed. 0 Bugs No Coverage information |
Description
Closes: #164
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and please add links to any
relevant follow-up issues.
I have...
in the PR title
!
to the type prefix if API or client breaking changesee PR Targeting)
for building modules
integration tests
CHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add your handle next to the items
reviewed if you only reviewed selected items.
I have...
correct type prefix in the PR title
!
in the type prefix if API or client breaking change