Fix repository tests
This commit is contained in:
parent
45324e169f
commit
2e957e7ebb
1 changed files with 16 additions and 4 deletions
|
@ -76,8 +76,11 @@ func Test_RepositoryMarshalJSON(t *testing.T) {
|
||||||
"with Team as IRI": {
|
"with Team as IRI": {
|
||||||
item: Repository{
|
item: Repository{
|
||||||
Team: ap.IRI("https://example.com/1"),
|
Team: ap.IRI("https://example.com/1"),
|
||||||
|
Actor: ap.Actor{
|
||||||
|
ID: "https://example.com/1",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
want: []byte(`{"team":"https://example.com/1"}`),
|
want: []byte(`{"id":"https://example.com/1","team":"https://example.com/1"}`),
|
||||||
},
|
},
|
||||||
"with Team as IRIs": {
|
"with Team as IRIs": {
|
||||||
item: Repository{
|
item: Repository{
|
||||||
|
@ -85,14 +88,20 @@ func Test_RepositoryMarshalJSON(t *testing.T) {
|
||||||
ap.IRI("https://example.com/1"),
|
ap.IRI("https://example.com/1"),
|
||||||
ap.IRI("https://example.com/2"),
|
ap.IRI("https://example.com/2"),
|
||||||
},
|
},
|
||||||
|
Actor: ap.Actor{
|
||||||
|
ID: "https://example.com/1",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
want: []byte(`{"team":["https://example.com/1","https://example.com/2"]}`),
|
want: []byte(`{"id":"https://example.com/1","team":["https://example.com/1","https://example.com/2"]}`),
|
||||||
},
|
},
|
||||||
"with Team as Object": {
|
"with Team as Object": {
|
||||||
item: Repository{
|
item: Repository{
|
||||||
Team: ap.Object{ID: "https://example.com/1"},
|
Team: ap.Object{ID: "https://example.com/1"},
|
||||||
|
Actor: ap.Actor{
|
||||||
|
ID: "https://example.com/1",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
want: []byte(`{"team":{"id":"https://example.com/1"}}`),
|
want: []byte(`{"id":"https://example.com/1","team":{"id":"https://example.com/1"}}`),
|
||||||
},
|
},
|
||||||
"with Team as slice of Objects": {
|
"with Team as slice of Objects": {
|
||||||
item: Repository{
|
item: Repository{
|
||||||
|
@ -100,8 +109,11 @@ func Test_RepositoryMarshalJSON(t *testing.T) {
|
||||||
ap.Object{ID: "https://example.com/1"},
|
ap.Object{ID: "https://example.com/1"},
|
||||||
ap.Object{ID: "https://example.com/2"},
|
ap.Object{ID: "https://example.com/2"},
|
||||||
},
|
},
|
||||||
|
Actor: ap.Actor{
|
||||||
|
ID: "https://example.com/1",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
want: []byte(`{"team":[{"id":"https://example.com/1"},{"id":"https://example.com/2"}]}`),
|
want: []byte(`{"id":"https://example.com/1","team":[{"id":"https://example.com/1"},{"id":"https://example.com/2"}]}`),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue