summaryrefslogtreecommitdiff
path: root/internal/typeutils/astointernal_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/typeutils/astointernal_test.go')
-rw-r--r--internal/typeutils/astointernal_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/typeutils/astointernal_test.go b/internal/typeutils/astointernal_test.go
index 69a50aed8..d06178fb1 100644
--- a/internal/typeutils/astointernal_test.go
+++ b/internal/typeutils/astointernal_test.go
@@ -74,6 +74,27 @@ func (suite *ASToInternalTestSuite) TestParsePublicStatus() {
suite.Equal(`<p>&gt; So we have to examine critical thinking as a signifier, dynamic and ambiguous. It has a normative definition, a tacit definition, and an ideal definition. One of the hallmarks of graduate training is learning to comprehend those definitions and applying the correct one as needed for professional success.</p>`, status.Content)
}
+func (suite *ASToInternalTestSuite) TestParsePublicStatusNoURL() {
+ m := make(map[string]interface{})
+ err := json.Unmarshal([]byte(publicStatusActivityJsonNoURL), &m)
+ suite.NoError(err)
+
+ t, err := streams.ToType(context.Background(), m)
+ suite.NoError(err)
+
+ rep, ok := t.(ap.Statusable)
+ suite.True(ok)
+
+ status, err := suite.typeconverter.ASStatusToStatus(context.Background(), rep)
+ suite.NoError(err)
+
+ suite.Equal("reading: Punishment and Reward in the Corporate University", status.ContentWarning)
+ suite.Equal(`<p>&gt; So we have to examine critical thinking as a signifier, dynamic and ambiguous. It has a normative definition, a tacit definition, and an ideal definition. One of the hallmarks of graduate training is learning to comprehend those definitions and applying the correct one as needed for professional success.</p>`, status.Content)
+
+ // on statuses with no URL in them (like ones we get from pleroma sometimes) we should use the AP URI of the status as URL
+ suite.Equal("http://fossbros-anonymous.io/users/foss_satan/statuses/108138763199405167", status.URL)
+}
+
func (suite *ASToInternalTestSuite) TestParseGargron() {
m := make(map[string]interface{})
err := json.Unmarshal([]byte(gargronAsActivityJson), &m)