mirror of
https://github.com/status-im/status-go.git
synced 2025-01-09 06:12:55 +00:00
0eef19f80e
- completely replace social links on save - respect the order of items and also the URL when comparing Rationale: for MVP, we'll want the user to be able to add several links of the same type, and adjust/preserve their order by drag'n'drop Needed for https://github.com/status-im/status-desktop/issues/9777
32 lines
697 B
Go
32 lines
697 B
Go
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))
|
|
|
|
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))
|
|
}
|