diff options
author | 2023-01-13 17:02:45 +0100 | |
---|---|---|
committer | 2023-01-13 17:02:45 +0100 | |
commit | eafd73c29204072050591a0579e0cedb174e6d38 (patch) | |
tree | 8cb581647e00f366395d97d27c36c6099e93754b /internal/federation/federatingdb | |
parent | [performance] media processing improvements (#1288) (diff) | |
download | gotosocial-eafd73c29204072050591a0579e0cedb174e6d38.tar.xz |
[chore] Remove omitempty on account source; refactor tests to use prettyprint json (#1337)
* remove omitEmpty tag on account source items
* update tests
Diffstat (limited to 'internal/federation/federatingdb')
-rw-r--r-- | internal/federation/federatingdb/followers_test.go | 8 | ||||
-rw-r--r-- | internal/federation/federatingdb/following_test.go | 11 |
2 files changed, 15 insertions, 4 deletions
diff --git a/internal/federation/federatingdb/followers_test.go b/internal/federation/federatingdb/followers_test.go index 0937c5d0e..9bc601677 100644 --- a/internal/federation/federatingdb/followers_test.go +++ b/internal/federation/federatingdb/followers_test.go @@ -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) { diff --git a/internal/federation/federatingdb/following_test.go b/internal/federation/federatingdb/following_test.go index 824530686..e769e5384 100644 --- a/internal/federation/federatingdb/following_test.go +++ b/internal/federation/federatingdb/following_test.go @@ -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) { |