From 4f322f527f6c6e043f9efa13034fed1dbd35f1eb Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Thu, 6 Apr 2023 13:16:53 +0200 Subject: [bugfix] Always serialize orderedItems as array (#1673) --- internal/typeutils/internaltoas_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'internal/typeutils/internaltoas_test.go') diff --git a/internal/typeutils/internaltoas_test.go b/internal/typeutils/internaltoas_test.go index 9c858947e..486866160 100644 --- a/internal/typeutils/internaltoas_test.go +++ b/internal/typeutils/internaltoas_test.go @@ -26,6 +26,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/superseriousbusiness/activity/streams" + "github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/testrig" @@ -669,7 +670,7 @@ func (suite *InternalToASTestSuite) TestPinnedStatusesToASSomeItems() { suite.FailNow(err.Error()) } - ser, err := streams.Serialize(collection) + ser, err := ap.SerializeOrderedCollection(collection) suite.NoError(err) bytes, err := json.MarshalIndent(ser, "", " ") @@ -701,7 +702,7 @@ func (suite *InternalToASTestSuite) TestPinnedStatusesToASNoItems() { suite.FailNow(err.Error()) } - ser, err := streams.Serialize(collection) + ser, err := ap.SerializeOrderedCollection(collection) suite.NoError(err) bytes, err := json.MarshalIndent(ser, "", " ") @@ -730,7 +731,7 @@ func (suite *InternalToASTestSuite) TestPinnedStatusesToASOneItem() { suite.FailNow(err.Error()) } - ser, err := streams.Serialize(collection) + ser, err := ap.SerializeOrderedCollection(collection) suite.NoError(err) bytes, err := json.MarshalIndent(ser, "", " ") @@ -739,7 +740,9 @@ func (suite *InternalToASTestSuite) TestPinnedStatusesToASOneItem() { suite.Equal(`{ "@context": "https://www.w3.org/ns/activitystreams", "id": "http://localhost:8080/users/1happyturtle/collections/featured", - "orderedItems": "http://localhost:8080/users/1happyturtle/statuses/01G20ZM733MGN8J344T4ZDDFY1", + "orderedItems": [ + "http://localhost:8080/users/1happyturtle/statuses/01G20ZM733MGN8J344T4ZDDFY1" + ], "totalItems": 1, "type": "OrderedCollection" }`, string(bytes)) -- cgit v1.2.3