-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
-
188
-
189
-
190
-
191
-
192
-
193
-
194
-
195
-
196
-
197
-
198
package activitypub
import (
"reflect"
"testing"
)
type testPairs map[ActivityVocabularyType]reflect.Type
var objectPtrType = reflect.TypeOf(new(*Object)).Elem()
var tombstoneType = reflect.TypeOf(new(*Tombstone)).Elem()
var profileType = reflect.TypeOf(new(*Profile)).Elem()
var placeType = reflect.TypeOf(new(*Place)).Elem()
var relationshipType = reflect.TypeOf(new(*Relationship)).Elem()
var linkPtrType = reflect.TypeOf(new(*Link)).Elem()
var mentionPtrType = reflect.TypeOf(new(*Mention)).Elem()
var activityPtrType = reflect.TypeOf(new(*Activity)).Elem()
var intransitiveActivityPtrType = reflect.TypeOf(new(*IntransitiveActivity)).Elem()
var collectionPtrType = reflect.TypeOf(new(*Collection)).Elem()
var collectionPagePtrType = reflect.TypeOf(new(*CollectionPage)).Elem()
var orderedCollectionPtrType = reflect.TypeOf(new(*OrderedCollection)).Elem()
var orderedCollectionPagePtrType = reflect.TypeOf(new(*OrderedCollectionPage)).Elem()
var actorPtrType = reflect.TypeOf(new(*Actor)).Elem()
var applicationPtrType = reflect.TypeOf(new(*Application)).Elem()
var servicePtrType = reflect.TypeOf(new(*Service)).Elem()
var personPtrType = reflect.TypeOf(new(*Person)).Elem()
var groupPtrType = reflect.TypeOf(new(*Group)).Elem()
var organizationPtrType = reflect.TypeOf(new(*Organization)).Elem()
var acceptPtrType = reflect.TypeOf(new(*Accept)).Elem()
var addPtrType = reflect.TypeOf(new(*Add)).Elem()
var announcePtrType = reflect.TypeOf(new(*Announce)).Elem()
var arrivePtrType = reflect.TypeOf(new(*Arrive)).Elem()
var blockPtrType = reflect.TypeOf(new(*Block)).Elem()
var createPtrType = reflect.TypeOf(new(*Create)).Elem()
var deletePtrType = reflect.TypeOf(new(*Delete)).Elem()
var dislikePtrType = reflect.TypeOf(new(*Dislike)).Elem()
var flagPtrType = reflect.TypeOf(new(*Flag)).Elem()
var followPtrType = reflect.TypeOf(new(*Follow)).Elem()
var ignorePtrType = reflect.TypeOf(new(*Ignore)).Elem()
var invitePtrType = reflect.TypeOf(new(*Invite)).Elem()
var joinPtrType = reflect.TypeOf(new(*Join)).Elem()
var leavePtrType = reflect.TypeOf(new(*Leave)).Elem()
var likePtrType = reflect.TypeOf(new(*Like)).Elem()
var listenPtrType = reflect.TypeOf(new(*Listen)).Elem()
var movePtrType = reflect.TypeOf(new(*Move)).Elem()
var offerPtrType = reflect.TypeOf(new(*Offer)).Elem()
var questionPtrType = reflect.TypeOf(new(*Question)).Elem()
var rejectPtrType = reflect.TypeOf(new(*Reject)).Elem()
var readPtrType = reflect.TypeOf(new(*Read)).Elem()
var removePtrType = reflect.TypeOf(new(*Remove)).Elem()
var tentativeRejectPtrType = reflect.TypeOf(new(*TentativeReject)).Elem()
var tentativeAcceptPtrType = reflect.TypeOf(new(*TentativeAccept)).Elem()
var travelPtrType = reflect.TypeOf(new(*Travel)).Elem()
var undoPtrType = reflect.TypeOf(new(*Undo)).Elem()
var updatePtrType = reflect.TypeOf(new(*Update)).Elem()
var viewPtrType = reflect.TypeOf(new(*View)).Elem()
var tests = testPairs{
ObjectType: objectPtrType,
ArticleType: objectPtrType,
AudioType: objectPtrType,
DocumentType: objectPtrType,
ImageType: objectPtrType,
NoteType: objectPtrType,
PageType: objectPtrType,
PlaceType: placeType,
ProfileType: profileType,
RelationshipType: relationshipType,
TombstoneType: tombstoneType,
VideoType: objectPtrType,
LinkType: linkPtrType,
MentionType: mentionPtrType,
CollectionType: collectionPtrType,
CollectionPageType: collectionPagePtrType,
OrderedCollectionType: orderedCollectionPtrType,
OrderedCollectionPageType: orderedCollectionPagePtrType,
ActorType: actorPtrType,
ApplicationType: applicationPtrType,
ServiceType: servicePtrType,
PersonType: personPtrType,
GroupType: groupPtrType,
OrganizationType: organizationPtrType,
ActivityType: activityPtrType,
IntransitiveActivityType: intransitiveActivityPtrType,
AcceptType: acceptPtrType,
AddType: addPtrType,
AnnounceType: announcePtrType,
ArriveType: arrivePtrType,
BlockType: blockPtrType,
CreateType: createPtrType,
DeleteType: deletePtrType,
DislikeType: dislikePtrType,
FlagType: flagPtrType,
FollowType: followPtrType,
IgnoreType: ignorePtrType,
InviteType: invitePtrType,
JoinType: joinPtrType,
LeaveType: leavePtrType,
LikeType: likePtrType,
ListenType: listenPtrType,
MoveType: movePtrType,
OfferType: offerPtrType,
QuestionType: questionPtrType,
RejectType: rejectPtrType,
ReadType: readPtrType,
RemoveType: removePtrType,
TentativeRejectType: tentativeRejectPtrType,
TentativeAcceptType: tentativeAcceptPtrType,
TravelType: travelPtrType,
UndoType: undoPtrType,
UpdateType: updatePtrType,
ViewType: viewPtrType,
}
func TestJSONGetItemByType(t *testing.T) {
for typ, test := range tests {
t.Run(string(typ), func(t *testing.T) {
v, err := JSONGetItemByType(typ)
if err != nil {
t.Error(err)
}
if reflect.TypeOf(v) != test {
t.Errorf("Invalid type returned %T, expected %s", v, test.String())
}
})
}
}
func TestUnmarshalJSON(t *testing.T) {
dataEmpty := []byte("{}")
i, err := UnmarshalJSON(dataEmpty)
if err != nil {
t.Errorf("invalid unmarshaling %s", err)
}
if i != nil {
t.Errorf("invalid unmarshaling, expected nil")
}
}
func TestJSONGetDuration(t *testing.T) {
t.Skipf("TODO")
}
func TestJSONGetInt(t *testing.T) {
}
func TestJSONGetIRI(t *testing.T) {
t.Skipf("TODO")
}
func TestJSONGetItem(t *testing.T) {
t.Skipf("TODO")
}
func TestJSONGetItems(t *testing.T) {
}
func TestJSONGetLangRefField(t *testing.T) {
t.Skipf("TODO")
}
func TestJSONGetMimeType(t *testing.T) {
t.Skipf("TODO")
}
func TestJSONGetObjectID(t *testing.T) {
t.Skipf("TODO")
}
func TestJSONGetNaturalLanguageField(t *testing.T) {
t.Skipf("TODO")
}
func TestJSONGetString(t *testing.T) {
t.Skipf("TODO")
}
func TestJSONGetTime(t *testing.T) {
t.Skipf("TODO")
}
func TestJSONGetType(t *testing.T) {
t.Skipf("TODO")
}
func TestJSONGetURIItem(t *testing.T) {
t.Skipf("TODO")
}
func TestJSONUnmarshalToItem(t *testing.T) {
t.Skipf("TODO")
}
func TestJSONGetActorEndpoints(t *testing.T) {
t.Skipf("TODO")
}