mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2026-01-03 17:13:16 -06:00
[bugfix] Always serialize orderedItems as array (#1673)
This commit is contained in:
parent
8d2a76c58c
commit
4f322f527f
4 changed files with 77 additions and 7 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue