summaryrefslogtreecommitdiff
path: root/internal/typeutils/wrap_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-01-13 17:02:45 +0100
committerLibravatar GitHub <noreply@github.com>2023-01-13 17:02:45 +0100
commiteafd73c29204072050591a0579e0cedb174e6d38 (patch)
tree8cb581647e00f366395d97d27c36c6099e93754b /internal/typeutils/wrap_test.go
parent[performance] media processing improvements (#1288) (diff)
downloadgotosocial-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/typeutils/wrap_test.go')
-rw-r--r--internal/typeutils/wrap_test.go49
1 files changed, 45 insertions, 4 deletions
diff --git a/internal/typeutils/wrap_test.go b/internal/typeutils/wrap_test.go
index 6e14f32d3..5a4e1c682 100644
--- a/internal/typeutils/wrap_test.go
+++ b/internal/typeutils/wrap_test.go
@@ -44,10 +44,19 @@ func (suite *WrapTestSuite) TestWrapNoteInCreateIRIOnly() {
createI, err := streams.Serialize(create)
suite.NoError(err)
- bytes, err := json.Marshal(createI)
+ bytes, err := json.MarshalIndent(createI, "", " ")
suite.NoError(err)
- suite.Equal(`{"@context":"https://www.w3.org/ns/activitystreams","actor":"http://localhost:8080/users/the_mighty_zork","cc":"http://localhost:8080/users/the_mighty_zork/followers","id":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/activity","object":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY","published":"2021-10-20T12:40:37+02:00","to":"https://www.w3.org/ns/activitystreams#Public","type":"Create"}`, string(bytes))
+ suite.Equal(`{
+ "@context": "https://www.w3.org/ns/activitystreams",
+ "actor": "http://localhost:8080/users/the_mighty_zork",
+ "cc": "http://localhost:8080/users/the_mighty_zork/followers",
+ "id": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/activity",
+ "object": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY",
+ "published": "2021-10-20T12:40:37+02:00",
+ "to": "https://www.w3.org/ns/activitystreams#Public",
+ "type": "Create"
+}`, string(bytes))
}
func (suite *WrapTestSuite) TestWrapNoteInCreate() {
@@ -63,10 +72,42 @@ func (suite *WrapTestSuite) TestWrapNoteInCreate() {
createI, err := streams.Serialize(create)
suite.NoError(err)
- bytes, err := json.Marshal(createI)
+ bytes, err := json.MarshalIndent(createI, "", " ")
suite.NoError(err)
- suite.Equal(`{"@context":"https://www.w3.org/ns/activitystreams","actor":"http://localhost:8080/users/the_mighty_zork","cc":"http://localhost:8080/users/the_mighty_zork/followers","id":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/activity","object":{"attachment":[],"attributedTo":"http://localhost:8080/users/the_mighty_zork","cc":"http://localhost:8080/users/the_mighty_zork/followers","content":"hello everyone!","id":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY","published":"2021-10-20T12:40:37+02:00","replies":{"first":{"id":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies?page=true","next":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies?only_other_accounts=false\u0026page=true","partOf":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies","type":"CollectionPage"},"id":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies","type":"Collection"},"sensitive":true,"summary":"introduction post","tag":[],"to":"https://www.w3.org/ns/activitystreams#Public","type":"Note","url":"http://localhost:8080/@the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY"},"published":"2021-10-20T12:40:37+02:00","to":"https://www.w3.org/ns/activitystreams#Public","type":"Create"}`, string(bytes))
+ suite.Equal(`{
+ "@context": "https://www.w3.org/ns/activitystreams",
+ "actor": "http://localhost:8080/users/the_mighty_zork",
+ "cc": "http://localhost:8080/users/the_mighty_zork/followers",
+ "id": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/activity",
+ "object": {
+ "attachment": [],
+ "attributedTo": "http://localhost:8080/users/the_mighty_zork",
+ "cc": "http://localhost:8080/users/the_mighty_zork/followers",
+ "content": "hello everyone!",
+ "id": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY",
+ "published": "2021-10-20T12:40:37+02:00",
+ "replies": {
+ "first": {
+ "id": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies?page=true",
+ "next": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies?only_other_accounts=false\u0026page=true",
+ "partOf": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies",
+ "type": "CollectionPage"
+ },
+ "id": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies",
+ "type": "Collection"
+ },
+ "sensitive": true,
+ "summary": "introduction post",
+ "tag": [],
+ "to": "https://www.w3.org/ns/activitystreams#Public",
+ "type": "Note",
+ "url": "http://localhost:8080/@the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY"
+ },
+ "published": "2021-10-20T12:40:37+02:00",
+ "to": "https://www.w3.org/ns/activitystreams#Public",
+ "type": "Create"
+}`, string(bytes))
}
func TestWrapTestSuite(t *testing.T) {