This repository has been archived on 2022-11-27. You can view files and clone it, but cannot push or open issues or pull requests.
activitypub/link_test.go

82 lines
1.7 KiB
Go
Raw Normal View History

package activitypub
import (
"testing"
)
func TestLinkNew(t *testing.T) {
2019-12-05 18:02:15 +00:00
var testValue = ID("test")
var testType ActivityVocabularyType
l := LinkNew(testValue, testType)
if l.ID != testValue {
t.Errorf("APObject Id '%v' different than expected '%v'", l.ID, testValue)
}
if l.Type != LinkType {
t.Errorf("APObject Type '%v' different than expected '%v'", l.Type, LinkType)
}
}
func TestValidLinkType(t *testing.T) {
var invalidType ActivityVocabularyType = "RandomType"
if ValidLinkType(LinkType) {
2018-07-18 15:39:27 +00:00
t.Errorf("Generic Link Type '%v' should not be valid", LinkType)
}
if ValidLinkType(invalidType) {
2018-07-18 15:39:27 +00:00
t.Errorf("Link Type '%v' should not be valid", invalidType)
}
for _, validType := range validLinkTypes {
if !ValidLinkType(validType) {
2018-07-18 15:39:27 +00:00
t.Errorf("Link Type '%v' should be valid", validType)
}
}
}
func TestLink_IsLink(t *testing.T) {
l := LinkNew("test", LinkType)
if !l.IsLink() {
t.Errorf("%#v should be a valid link", l.Type)
}
m := LinkNew("test", MentionType)
if !m.IsLink() {
t.Errorf("%#v should be a valid link", m.Type)
}
}
func TestLink_IsObject(t *testing.T) {
l := LinkNew("test", LinkType)
if l.IsObject() {
t.Errorf("%#v should not be a valid object", l.Type)
}
m := LinkNew("test", MentionType)
if m.IsObject() {
t.Errorf("%#v should not be a valid object", m.Type)
}
}
2018-11-10 21:37:06 +00:00
func TestLink_GetID(t *testing.T) {
2019-05-05 07:32:45 +00:00
t.Skipf("TODO")
2018-11-10 21:37:06 +00:00
}
func TestLink_GetLink(t *testing.T) {
2019-05-05 07:32:45 +00:00
t.Skipf("TODO")
2018-11-10 21:37:06 +00:00
}
func TestLink_GetType(t *testing.T) {
2019-05-05 07:32:45 +00:00
t.Skipf("TODO")
2018-11-10 21:37:06 +00:00
}
func TestLink_UnmarshalJSON(t *testing.T) {
2019-05-05 07:32:45 +00:00
t.Skipf("TODO")
2018-11-10 21:37:06 +00:00
}
func TestMentionNew(t *testing.T) {
2019-05-05 07:32:45 +00:00
t.Skipf("TODO")
2018-11-10 21:37:06 +00:00
}
func TestLink_IsCollection(t *testing.T) {
2019-05-05 07:32:45 +00:00
t.Skipf("TODO")
2018-11-10 21:37:06 +00:00
}