[chore] Remove omitempty on account source; refactor tests to use prettyprint json (#1337)

* remove omitEmpty tag on account source items

* update tests
This commit is contained in:
tobi 2023-01-13 17:02:45 +01:00 committed by GitHub
commit eafd73c292
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 1605 additions and 163 deletions

View file

@ -41,11 +41,15 @@ func (suite *FollowersTestSuite) TestGetFollowers() {
fi, err := streams.Serialize(f)
suite.NoError(err)
fJson, err := json.Marshal(fi)
fJson, err := json.MarshalIndent(fi, "", " ")
suite.NoError(err)
// zork follows local_account_2 so this should be reflected in the response
suite.Equal(`{"@context":"https://www.w3.org/ns/activitystreams","items":"http://localhost:8080/users/the_mighty_zork","type":"Collection"}`, string(fJson))
suite.Equal(`{
"@context": "https://www.w3.org/ns/activitystreams",
"items": "http://localhost:8080/users/the_mighty_zork",
"type": "Collection"
}`, string(fJson))
}
func TestFollowersTestSuite(t *testing.T) {

View file

@ -41,11 +41,18 @@ func (suite *FollowingTestSuite) TestGetFollowing() {
fi, err := streams.Serialize(f)
suite.NoError(err)
fJson, err := json.Marshal(fi)
fJson, err := json.MarshalIndent(fi, "", " ")
suite.NoError(err)
// zork follows admin account and local_account_1
suite.Equal(`{"@context":"https://www.w3.org/ns/activitystreams","items":["http://localhost:8080/users/admin","http://localhost:8080/users/1happyturtle"],"type":"Collection"}`, string(fJson))
suite.Equal(`{
"@context": "https://www.w3.org/ns/activitystreams",
"items": [
"http://localhost:8080/users/admin",
"http://localhost:8080/users/1happyturtle"
],
"type": "Collection"
}`, string(fJson))
}
func TestFollowingTestSuite(t *testing.T) {