Update tests
This commit is contained in:
parent
5f0c53da17
commit
1a25cdae6f
|
@ -26,7 +26,7 @@ func TestGetSetProposal(t *testing.T) {
|
||||||
|
|
||||||
gotProposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
|
gotProposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
require.Equal(t, proposal.String(), gotProposal.String())
|
require.True(t, proposal.Equal(gotProposal))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestActivateVotingPeriod(t *testing.T) {
|
func TestActivateVotingPeriod(t *testing.T) {
|
||||||
|
|
|
@ -37,6 +37,11 @@ func NewProposal(content Content, id uint64, submitTime, depositEndTime time.Tim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Equal returns true if two Proposal types are equal.
|
||||||
|
func (p Proposal) Equal(other Proposal) bool {
|
||||||
|
return p.ProposalBase.Equal(other.ProposalBase) && p.Content.String() == other.Content.String()
|
||||||
|
}
|
||||||
|
|
||||||
// String implements stringer interface
|
// String implements stringer interface
|
||||||
func (p Proposal) String() string {
|
func (p Proposal) String() string {
|
||||||
out, _ := yaml.Marshal(p)
|
out, _ := yaml.Marshal(p)
|
||||||
|
@ -189,14 +194,14 @@ const (
|
||||||
ProposalTypeText string = "Text"
|
ProposalTypeText string = "Text"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Implements Content Interface
|
||||||
|
var _ Content = TextProposal{}
|
||||||
|
|
||||||
// NewTextProposal creates a text proposal Content
|
// NewTextProposal creates a text proposal Content
|
||||||
func NewTextProposal(title, description string) Content {
|
func NewTextProposal(title, description string) Content {
|
||||||
return TextProposal{title, description}
|
return TextProposal{title, description}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements Content Interface
|
|
||||||
var _ Content = TextProposal{}
|
|
||||||
|
|
||||||
// GetTitle returns the proposal title
|
// GetTitle returns the proposal title
|
||||||
func (tp TextProposal) GetTitle() string { return tp.Title }
|
func (tp TextProposal) GetTitle() string { return tp.Title }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue