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",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2022-08-10 13:09:15 +00:00
|
|
|
protobufLinks := []*protobuf.SocialLink{}
|
|
|
|
transformedLinks := NewSocialLinks(protobufLinks)
|
|
|
|
require.False(t, socialLinks.Equals(*transformedLinks))
|
2022-08-02 12:56:26 +00:00
|
|
|
|
2022-08-10 13:09:15 +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
|
2022-08-10 13:09:15 +00:00
|
|
|
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
|
|
|
}
|