Skip to content

Commit

Permalink
test: add tests on ReceiveFromTreasuryAuthorization
Browse files Browse the repository at this point in the history
  • Loading branch information
0Tech committed May 26, 2022
1 parent 4aacf75 commit 7de6d34
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions x/foundation/authz_test.go
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)
}
}

0 comments on commit 7de6d34

Please sign in to comment.