-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix genesis and support abstain (#545)
* test: replace hardcoded literal * fix: fix init genesis * fix: support abstain * docs: update CHANGELOG.md * test: add tests on ReceiveFromTreasuryAuthorization * fix: fix under estimation of undecided count
- Loading branch information
Showing
13 changed files
with
483 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package foundation_test | ||
|
||
import ( | ||
"testing" | ||
|
||
sdk "github.com/line/lbm-sdk/types" | ||
"github.com/line/lbm-sdk/x/foundation" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestReceiveFromTreasuryAuthorization(t *testing.T) { | ||
testCases := map[string]struct{ | ||
msg sdk.Msg | ||
valid bool | ||
accept bool | ||
}{ | ||
"valid": { | ||
msg: &foundation.MsgWithdrawFromTreasury{}, | ||
valid: true, | ||
accept: true, | ||
}, | ||
"msg mismatch": { | ||
msg: &foundation.MsgVote{}, | ||
}, | ||
} | ||
|
||
for name, tc := range testCases { | ||
authorization := &foundation.ReceiveFromTreasuryAuthorization{} | ||
|
||
resp, err := authorization.Accept(sdk.Context{}, tc.msg) | ||
if !tc.valid { | ||
require.Error(t, err, name) | ||
continue | ||
} | ||
require.NoError(t, err, name) | ||
|
||
require.Equal(t, tc.accept, resp.Accept) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.