Skip to content
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

feat(x/ecocredit): add basket years in the past #874

Merged
merged 26 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
901ae89
feat(x/ecocredit): add basket fixed start date
ryanchristo Mar 10, 2022
8637df3
feat(x/ecocredit): add basket fixed start date
ryanchristo Mar 10, 2022
d8b57a6
feat(x/ecocredit): add basket fixed start date
ryanchristo Mar 10, 2022
32025e6
feat(x/ecocredit): add basket fixed start date
ryanchristo Mar 10, 2022
ff0e44d
feat(x/ecocredit): add basket fixed start date
ryanchristo Mar 10, 2022
0e50842
feat(x/ecocredit): add basket fixed start date
ryanchristo Mar 10, 2022
e679f23
feat(x/ecocredit): add basket fixed start date
ryanchristo Mar 10, 2022
f616366
feat(x/ecocredit): add basket fixed start date
ryanchristo Mar 11, 2022
4d87960
address review comments
ryanchristo Mar 11, 2022
0119fb1
Merge branch 'master' into ryan/820-basket-start-date
ryanchristo Mar 11, 2022
a58c3dc
fix generated proto
ryanchristo Mar 11, 2022
8edb3f4
fix generated proto
ryanchristo Mar 11, 2022
a5b31c3
add revision and since
ryanchristo Mar 11, 2022
1dd8af0
add revision and since
ryanchristo Mar 11, 2022
cbb80c2
Merge branch 'master' into ryan/820-basket-start-date
ryanchristo Mar 11, 2022
98e5396
fix proto gen
ryanchristo Mar 11, 2022
a54542a
Merge branch 'master' into ryan/820-basket-start-date
ryanchristo Mar 11, 2022
c9708ca
Merge branch 'master' into ryan/820-basket-start-date
ryanchristo Mar 11, 2022
1571cd2
merge updates
ryanchristo Mar 12, 2022
9a6eaff
Merge branch 'master' into ryan/820-basket-start-date
ryanchristo Mar 12, 2022
3a5e6c1
Merge branch 'master' into ryan/820-basket-start-date
ryanchristo Mar 14, 2022
9f5c29f
Merge branch 'master' into ryan/820-basket-start-date
ryanchristo Mar 15, 2022
de90601
Merge branch 'master' into ryan/820-basket-start-date
ryanchristo Mar 15, 2022
44b2657
fix tests
ryanchristo Mar 15, 2022
44b246b
Merge branch 'master' into ryan/820-basket-start-date
ryanchristo Mar 15, 2022
1e394b1
rename package
ryanchristo Mar 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
address review comments
  • Loading branch information
ryanchristo committed Mar 11, 2022
commit 4d879609bad6811c07cd40786d21c16183053f8b
4 changes: 0 additions & 4 deletions x/ecocredit/basket/msg_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ func validateDateCriteria(d *DateCriteria) error {
if startDateWindow.Seconds < 24*3600 {
return errBadReq.Wrap("date_criteria.start_date_window must be at least 1 day")
}
} else if yearsInThePast != 0 {
// continue
} else {
return errBadReq.Wrapf("unsupported date_criteria value %v", d)
}
return nil
}
Expand Down
24 changes: 3 additions & 21 deletions x/ecocredit/basket/msg_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestMsgCreateValidateBasic(t *testing.T) {
{"name-short",
MsgCreate{Curator: a, Name: randstr.String(nameMinLen - 1)},
"name must start with an alphabetic character"},
{"name-no-alpahnum",
{"name-no-alphanum",
MsgCreate{Curator: a, Name: randstr.String(nameMinLen) + "*"},
"name must start with an alphabetic character"},
{"name-no-alpah-prefix",
Expand All @@ -59,15 +59,12 @@ func TestMsgCreateValidateBasic(t *testing.T) {
{"exponent-2",
MsgCreate{Curator: a, Name: name, Exponent: 17},
"exponent must be one of [0 1 2 3 6 9 12 15 18 21 24]"},
{"credity_type-1",
{"credit_type-1",
MsgCreate{Curator: a, Name: name, Exponent: 3},
"credit type abbreviation must be 1-3"},
{"credity_type-2",
{"credit_type-2",
MsgCreate{Curator: a, Name: name, Exponent: 3, CreditTypeAbbrev: randstr.String(creditTypeAbbrMaxLen + 1)},
"credit type abbreviation must be 1-3"},
{"date_criteria-1",
MsgCreate{Curator: a, Name: name, Exponent: 3, CreditTypeAbbrev: creditAbbr, DateCriteria: &DateCriteria{}},
"unsupported date_criteria value"},
{"description",
MsgCreate{Curator: a, Name: name, Exponent: 3, CreditTypeAbbrev: creditAbbr, DateCriteria: start, Description: randstr.String(descrMaxLen + 1)},
"description can't be longer"},
Expand Down Expand Up @@ -102,33 +99,18 @@ func TestMsgCreateValidateDateCriteria(t *testing.T) {
d DateCriteria
err string
}{
{
"nil-min_start_date",
DateCriteria{MinStartDate: nil},
"unsupported date_criteria value",
},
{
"bad-min_start_date",
DateCriteria{MinStartDate: &gogotypes.Timestamp{
Seconds: time.Date(1400, 1, 1, 0, 0, 0, 0, time.UTC).Unix()},
},
"date_criteria.min_start_date must be after",
},
{
"nil-start_date_window",
DateCriteria{StartDateWindow: nil},
"unsupported date_criteria value",
},
{
"bad-start_date_window",
DateCriteria{StartDateWindow: &gogotypes.Duration{Seconds: 3600}},
"date_criteria.start_date_window must be at least 1 day",
},
{
"zero-years_in_the_past",
DateCriteria{YearsInThePast: 0},
"unsupported date_criteria value",
},
{
"both-min_start_date-start_date_window-set",
DateCriteria{
Expand Down
5 changes: 0 additions & 5 deletions x/ecocredit/features/basket/create.feature
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,3 @@ Feature: Create Basket
When user tries to create a basket
And user provides a minimum start date that is less than 1 day
Then basket is NOT created

Scenario: basket years in the past must be a positive integer
When user tries to create a basket
And user provides years in the past that is less than 1
Then basket is NOT created