diff options
author | 2023-11-27 14:14:28 +0100 | |
---|---|---|
committer | 2023-11-27 13:14:28 +0000 | |
commit | e4e0a5e3f66f38e17a8abdafbeac251c75323b0e (patch) | |
tree | 6dc6211acd78df9fa3b933f19ab3275c187a5106 /internal/typeutils/internaltoas_test.go | |
parent | [chore]: Bump golang.org/x/net from 0.17.0 to 0.18.0 (#2390) (diff) | |
download | gotosocial-e4e0a5e3f66f38e17a8abdafbeac251c75323b0e.tar.xz |
[bugfix] Add Actor to outgoing poll vote Create; other fixes (#2384)
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)) } |