-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathflatten_test.go
89 lines (81 loc) · 1.88 KB
/
flatten_test.go
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
package activitypub
import (
"reflect"
"testing"
)
func TestFlattenPersonProperties(t *testing.T) {
t.Skipf("TODO")
}
func TestFlattenProperties(t *testing.T) {
t.Skipf("TODO")
}
func TestFlattenItemCollection(t *testing.T) {
t.Skipf("TODO")
}
func TestFlattenCollection(t *testing.T) {
t.Skipf("TODO")
}
func TestFlattenOrderedCollection(t *testing.T) {
t.Skipf("TODO")
}
func TestFlattenIntransitiveActivityProperties(t *testing.T) {
type args struct {
act *IntransitiveActivity
}
tests := []struct {
name string
args args
want *IntransitiveActivity
}{
{
name: "blank",
args: args{&IntransitiveActivity{}},
want: &IntransitiveActivity{},
},
{
name: "flatten-actor",
args: args{&IntransitiveActivity{Actor: &Actor{ID: "example-actor-iri"}}},
want: &IntransitiveActivity{Actor: IRI("example-actor-iri")},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := FlattenIntransitiveActivityProperties(tt.args.act); !reflect.DeepEqual(got, tt.want) {
t.Errorf("FlattenIntransitiveActivityProperties() = %v, want %v", got, tt.want)
}
})
}
}
func TestFlattenActivityProperties(t *testing.T) {
type args struct {
act *Activity
}
tests := []struct {
name string
args args
want *Activity
}{
{
name: "blank",
args: args{&Activity{}},
want: &Activity{},
},
{
name: "flatten-actor",
args: args{&Activity{Actor: &Actor{ID: "example-actor-iri"}}},
want: &Activity{Actor: IRI("example-actor-iri")},
},
{
name: "flatten-object",
args: args{&Activity{Object: &Object{ID: "example-actor-iri"}}},
want: &Activity{Object: IRI("example-actor-iri")},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := FlattenActivityProperties(tt.args.act); !reflect.DeepEqual(got, tt.want) {
t.Errorf("FlattenActivityProperties() = %v, want %v", got, tt.want)
}
})
}
}