meowlib/contactcard_test.go

30 lines
809 B
Go
Raw Normal View History

package meowlib
import (
"testing"
2023-12-31 23:28:10 +01:00
"github.com/stretchr/testify/assert"
)
func TestCompress(t *testing.T) {
kp1 := NewKeyPair()
kp2 := NewKeyPair()
kp3 := NewKeyPair()
var cc ContactCard
cc.Name = "My Full Name And It's loooong"
cc.ContactPublicKey = kp1.Public
cc.EncryptionPublicKey = kp2.Public
cc.LookupPublicKey = kp3.Public
2024-01-01 22:45:54 +01:00
cc.InvitationMessage = "hello, it's me"
cc.AddUrls([]string{"https://meow.myfirstdomain.com/services/meow:8080", "https://meow.myseconddomain.com/services/meow:8080", "http://meow.mythirddomain.com/services/meow:8080"})
serialized, _ := cc.Serialize()
println(len(serialized))
compressed, _ := cc.Compress()
println(len(compressed))
2023-12-31 23:28:10 +01:00
ncc, err := NewContactCardFromCompressed(compressed)
if err != nil {
println(err)
}
assert.Equal(t, ncc.Name, cc.Name)
}