Update tests

This commit is contained in:
Aleksandr Bezobchuk 2020-03-02 17:21:00 -05:00
parent 5f0c53da17
commit 1a25cdae6f
No known key found for this signature in database
GPG Key ID: 7DAC30FBD99879B0
2 changed files with 9 additions and 4 deletions

View File

@ -26,7 +26,7 @@ func TestGetSetProposal(t *testing.T) {
gotProposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
require.True(t, ok)
require.Equal(t, proposal.String(), gotProposal.String())
require.True(t, proposal.Equal(gotProposal))
}
func TestActivateVotingPeriod(t *testing.T) {

View File

@ -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
func (p Proposal) String() string {
out, _ := yaml.Marshal(p)
@ -189,14 +194,14 @@ const (
ProposalTypeText string = "Text"
)
// Implements Content Interface
var _ Content = TextProposal{}
// NewTextProposal creates a text proposal Content
func NewTextProposal(title, description string) Content {
return TextProposal{title, description}
}
// Implements Content Interface
var _ Content = TextProposal{}
// GetTitle returns the proposal title
func (tp TextProposal) GetTitle() string { return tp.Title }