status-go/protocol/identity/social_links_test.go

39 lines
1.0 KiB
Go
Raw Normal View History

2022-08-02 12:56:26 +00:00
package identity
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/status-im/status-go/protocol/protobuf"
)
func TestEquals(t *testing.T) {
socialLinks := SocialLinks{
{
Text: "A",
URL: "B",
},
{
Text: "X",
URL: "Y",
},
}
protobufLinks := []*protobuf.SocialLink{}
transformedLinks := NewSocialLinks(protobufLinks)
require.False(t, socialLinks.Equals(*transformedLinks))
2022-08-02 12:56:26 +00:00
protobufLinks = append(protobufLinks, &protobuf.SocialLink{Text: "A", Url: "B"})
protobufLinks = append(protobufLinks, &protobuf.SocialLink{Text: "X", Url: "Y"})
transformedLinks = NewSocialLinks(protobufLinks)
require.True(t, socialLinks.Equals(*transformedLinks))
2022-08-02 12:56:26 +00:00
// order does not matter
protobufLinks = []*protobuf.SocialLink{}
protobufLinks = append(protobufLinks, &protobuf.SocialLink{Text: "X", Url: "Y"})
protobufLinks = append(protobufLinks, &protobuf.SocialLink{Text: "A", Url: "B"})
transformedLinks = NewSocialLinks(protobufLinks)
require.True(t, socialLinks.Equals(*transformedLinks))
2022-08-02 12:56:26 +00:00
}