diff options
Diffstat (limited to 'internal/typeutils/internaltoas_test.go')
-rw-r--r-- | internal/typeutils/internaltoas_test.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/internal/typeutils/internaltoas_test.go b/internal/typeutils/internaltoas_test.go index 878040dcc..0e0607279 100644 --- a/internal/typeutils/internaltoas_test.go +++ b/internal/typeutils/internaltoas_test.go @@ -879,6 +879,48 @@ func (suite *InternalToASTestSuite) TestPinnedStatusesToASOneItem() { }`, string(bytes)) } +func (suite *InternalToASTestSuite) TestPollVoteToASCreate() { + vote := suite.testPollVotes["remote_account_1_status_2_poll_vote_local_account_1"] + + create, err := suite.typeconverter.PollVoteToASCreate(context.Background(), vote) + if err != nil { + suite.FailNow(err.Error()) + } + + createI, err := ap.Serialize(create) + suite.NoError(err) + + 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", + "id": "http://localhost:8080/users/the_mighty_zork/activity#vote/http://fossbros-anonymous.io/users/foss_satan/statuses/01HEN2QRFA8H3C6QPN7RD4KSR6", + "object": [ + { + "attributedTo": "http://localhost:8080/users/the_mighty_zork", + "id": "http://localhost:8080/users/the_mighty_zork#01HEN2R65468ZG657C4ZPHJ4EX/votes/1", + "inReplyTo": "http://fossbros-anonymous.io/users/foss_satan/statuses/01HEN2QRFA8H3C6QPN7RD4KSR6", + "name": "tissues", + "to": "http://fossbros-anonymous.io/users/foss_satan", + "type": "Note" + }, + { + "attributedTo": "http://localhost:8080/users/the_mighty_zork", + "id": "http://localhost:8080/users/the_mighty_zork#01HEN2R65468ZG657C4ZPHJ4EX/votes/2", + "inReplyTo": "http://fossbros-anonymous.io/users/foss_satan/statuses/01HEN2QRFA8H3C6QPN7RD4KSR6", + "name": "financial times", + "to": "http://fossbros-anonymous.io/users/foss_satan", + "type": "Note" + } + ], + "published": "2021-09-11T11:45:37+02:00", + "to": "http://fossbros-anonymous.io/users/foss_satan", + "type": "Create" +}`, string(bytes)) +} + func TestInternalToASTestSuite(t *testing.T) { suite.Run(t, new(InternalToASTestSuite)) } |