mirror of
				https://github.com/0glabs/0g-chain.git
				synced 2025-11-04 06:48:03 +00:00 
			
		
		
		
	add cli help text test
This commit is contained in:
		
							parent
							
								
									733711c88c
								
							
						
					
					
						commit
						114097edb3
					
				
							
								
								
									
										36
									
								
								x/committee/client/cli/cli_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								x/committee/client/cli/cli_test.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,36 @@
 | 
			
		||||
package cli_test
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/cosmos/cosmos-sdk/codec"
 | 
			
		||||
	"github.com/stretchr/testify/suite"
 | 
			
		||||
 | 
			
		||||
	"github.com/kava-labs/kava/app"
 | 
			
		||||
	"github.com/kava-labs/kava/x/committee/client/cli"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type CLITestSuite struct {
 | 
			
		||||
	suite.Suite
 | 
			
		||||
	cdc *codec.Codec
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (suite *CLITestSuite) SetupTest() {
 | 
			
		||||
	ahpp := app.NewTestApp()
 | 
			
		||||
	suite.cdc = ahpp.Codec()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (suite *CLITestSuite) TestExampleCommitteeChangeProposal() {
 | 
			
		||||
	suite.NotPanics(func() { cli.MustGetExampleCommitteeChangeProposal(suite.cdc) })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (suite *CLITestSuite) TestExampleCommitteeDeleteProposal() {
 | 
			
		||||
	suite.NotPanics(func() { cli.MustGetExampleCommitteeDeleteProposal(suite.cdc) })
 | 
			
		||||
}
 | 
			
		||||
func (suite *CLITestSuite) TestExampleParameterChangeProposal() {
 | 
			
		||||
	suite.NotPanics(func() { cli.MustGetExampleParameterChangeProposal(suite.cdc) })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestCLITestSuite(t *testing.T) {
 | 
			
		||||
	suite.Run(t, new(CLITestSuite))
 | 
			
		||||
}
 | 
			
		||||
@ -49,7 +49,7 @@ func GetCmdSubmitProposal(cdc *codec.Codec) *cobra.Command {
 | 
			
		||||
The proposal file must be the json encoded forms of the proposal type you want to submit.
 | 
			
		||||
For example:
 | 
			
		||||
%s
 | 
			
		||||
`, mustGetExampleParameterChangeProposal(cdc)),
 | 
			
		||||
`, MustGetExampleParameterChangeProposal(cdc)),
 | 
			
		||||
		Args:    cobra.ExactArgs(2),
 | 
			
		||||
		Example: fmt.Sprintf("%s tx %s submit-proposal 1 your-proposal.json", version.ClientName, types.ModuleName),
 | 
			
		||||
		RunE: func(cmd *cobra.Command, args []string) error {
 | 
			
		||||
@ -139,7 +139,7 @@ For example, to create or update a committee:
 | 
			
		||||
 | 
			
		||||
and to delete a committee:
 | 
			
		||||
%s
 | 
			
		||||
`, mustGetExampleCommitteeChangeProposal(cdc), mustGetExampleCommitteeDeleteProposal(cdc)),
 | 
			
		||||
`, MustGetExampleCommitteeChangeProposal(cdc), MustGetExampleCommitteeDeleteProposal(cdc)),
 | 
			
		||||
		Args: cobra.ExactArgs(2),
 | 
			
		||||
		RunE: func(cmd *cobra.Command, args []string) error {
 | 
			
		||||
			txBldr := auth.NewTxBuilderFromCLI().WithTxEncoder(utils.GetTxEncoder(cdc))
 | 
			
		||||
@ -181,8 +181,8 @@ and to delete a committee:
 | 
			
		||||
	return cmd
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// mustGetExampleCommitteeChangeProposal is a helper function to return an example json proposal
 | 
			
		||||
func mustGetExampleCommitteeChangeProposal(cdc *codec.Codec) string {
 | 
			
		||||
// MustGetExampleCommitteeChangeProposal is a helper function to return an example json proposal
 | 
			
		||||
func MustGetExampleCommitteeChangeProposal(cdc *codec.Codec) string {
 | 
			
		||||
	exampleChangeProposal := types.NewCommitteeChangeProposal(
 | 
			
		||||
		"A Title",
 | 
			
		||||
		"A description of this proposal.",
 | 
			
		||||
@ -206,8 +206,8 @@ func mustGetExampleCommitteeChangeProposal(cdc *codec.Codec) string {
 | 
			
		||||
	return string(exampleChangeProposalBz)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// mustGetExampleCommitteeDeleteProposal is a helper function to return an example json proposal
 | 
			
		||||
func mustGetExampleCommitteeDeleteProposal(cdc *codec.Codec) string {
 | 
			
		||||
// MustGetExampleCommitteeDeleteProposal is a helper function to return an example json proposal
 | 
			
		||||
func MustGetExampleCommitteeDeleteProposal(cdc *codec.Codec) string {
 | 
			
		||||
	exampleDeleteProposal := types.NewCommitteeDeleteProposal(
 | 
			
		||||
		"A Title",
 | 
			
		||||
		"A description of this proposal.",
 | 
			
		||||
@ -220,8 +220,8 @@ func mustGetExampleCommitteeDeleteProposal(cdc *codec.Codec) string {
 | 
			
		||||
	return string(exampleDeleteProposalBz)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// mustGetExampleParameterChangeProposal is a helper function to return an example json proposal
 | 
			
		||||
func mustGetExampleParameterChangeProposal(cdc *codec.Codec) string {
 | 
			
		||||
// MustGetExampleParameterChangeProposal is a helper function to return an example json proposal
 | 
			
		||||
func MustGetExampleParameterChangeProposal(cdc *codec.Codec) string {
 | 
			
		||||
	exampleParameterChangeProposal := params.NewParameterChangeProposal(
 | 
			
		||||
		"A Title",
 | 
			
		||||
		"A description of this proposal.",
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user