diff options
Diffstat (limited to 'internal/typeutils/internaltoas_test.go')
-rw-r--r-- | internal/typeutils/internaltoas_test.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/internal/typeutils/internaltoas_test.go b/internal/typeutils/internaltoas_test.go index d9a91b736..0bbb80dac 100644 --- a/internal/typeutils/internaltoas_test.go +++ b/internal/typeutils/internaltoas_test.go @@ -510,6 +510,40 @@ func (suite *InternalToASTestSuite) TestSelfBoostFollowersOnlyToAS() { }`, string(bytes)) } +func (suite *InternalToASTestSuite) TestReportToAS() { + ctx := context.Background() + + testReport := suite.testReports["local_account_2_report_remote_account_1"] + account := suite.testAccounts["local_account_2"] + targetAccount := suite.testAccounts["remote_account_1"] + statuses := []*gtsmodel.Status{suite.testStatuses["remote_account_1_status_1"]} + + testReport.Account = account + testReport.TargetAccount = targetAccount + testReport.Statuses = statuses + + flag, err := suite.typeconverter.ReportToASFlag(ctx, testReport) + suite.NoError(err) + + ser, err := streams.Serialize(flag) + suite.NoError(err) + + bytes, err := json.MarshalIndent(ser, "", " ") + suite.NoError(err) + + suite.Equal(`{ + "@context": "https://www.w3.org/ns/activitystreams", + "actor": "http://localhost:8080/users/localhost:8080", + "content": "dark souls sucks, please yeet this nerd", + "id": "http://localhost:8080/reports/01GP3AWY4CRDVRNZKW0TEAMB5R", + "object": [ + "http://fossbros-anonymous.io/users/foss_satan", + "http://fossbros-anonymous.io/users/foss_satan/statuses/01FVW7JHQFSFK166WWKR8CBA6M" + ], + "type": "Flag" +}`, string(bytes)) +} + func TestInternalToASTestSuite(t *testing.T) { suite.Run(t, new(InternalToASTestSuite)) } |