summaryrefslogtreecommitdiff
path: root/internal/text/markdown_test.go
diff options
context:
space:
mode:
authorLibravatar Autumn! <86073772+autumnull@users.noreply.github.com>2022-12-16 11:20:22 +0000
committerLibravatar GitHub <noreply@github.com>2022-12-16 12:20:22 +0100
commiteb08529f35ce33ed98c34fb48013f0f4a5fc9635 (patch)
tree394fd774a943f5c33ce793c67b5865f2570b46c5 /internal/text/markdown_test.go
parent[bugfix] use match-sorter for filtering domain blocks (#1270) (diff)
downloadgotosocial-eb08529f35ce33ed98c34fb48013f0f4a5fc9635.tar.xz
[chore/bugfix] Switch markdown from blackfriday to goldmark (#1267)
Co-authored-by: Autumn! <autumnull@posteo.net>
Diffstat (limited to 'internal/text/markdown_test.go')
-rw-r--r--internal/text/markdown_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/text/markdown_test.go b/internal/text/markdown_test.go
index 6b7c1032f..3a67218d4 100644
--- a/internal/text/markdown_test.go
+++ b/internal/text/markdown_test.go
@@ -71,6 +71,12 @@ const (
mdMentionAndCodeBlockExpected = "<p><span class=\"h-card\"><a href=\"http://localhost:8080/@the_mighty_zork\" class=\"u-url mention\" rel=\"nofollow noreferrer noopener\" target=\"_blank\">@<span>the_mighty_zork</span></a></span></p><pre><code>@the_mighty_zork\n</code></pre>"
mdWithSmartypants = "\"you have to quargle the bleepflorp\" they said with 1/2 of nominal speed and 1/3 of the usual glumping"
mdWithSmartypantsExpected = "<p>\"you have to quargle the bleepflorp\" they said with 1/2 of nominal speed and 1/3 of the usual glumping</p>"
+ mdWithAsciiHeart = "hello <3 old friend <3 i loved u </3 :(( you stole my heart"
+ mdWithAsciiHeartExpected = "<p>hello &lt;3 old friend &lt;3 i loved u &lt;/3 :(( you stole my heart</p>"
+ mdWithStrikethrough = "I have ~~mdae~~ made an error"
+ mdWithStrikethroughExpected = "<p>I have <del>mdae</del> made an error</p>"
+ mdWithLink = "Check out this code, i heard it was written by a sloth https://github.com/superseriousbusiness/gotosocial"
+ mdWithLinkExpected = "<p>Check out this code, i heard it was written by a sloth <a href=\"https://github.com/superseriousbusiness/gotosocial\" rel=\"nofollow noreferrer noopener\" target=\"_blank\">https://github.com/superseriousbusiness/gotosocial</a></p>"
)
type MarkdownTestSuite struct {
@@ -160,6 +166,21 @@ func (suite *MarkdownTestSuite) TestParseSmartypants() {
suite.Equal(mdWithSmartypantsExpected, s)
}
+func (suite *MarkdownTestSuite) TestParseAsciiHeart() {
+ s := suite.formatter.FromMarkdown(context.Background(), mdWithAsciiHeart, nil, nil, nil)
+ suite.Equal(mdWithAsciiHeartExpected, s)
+}
+
+func (suite *MarkdownTestSuite) TestParseStrikethrough() {
+ s := suite.formatter.FromMarkdown(context.Background(), mdWithStrikethrough, nil, nil, nil)
+ suite.Equal(mdWithStrikethroughExpected, s)
+}
+
+func (suite *MarkdownTestSuite) TestParseLink() {
+ s := suite.formatter.FromMarkdown(context.Background(), mdWithLink, nil, nil, nil)
+ suite.Equal(mdWithLinkExpected, s)
+}
+
func TestMarkdownTestSuite(t *testing.T) {
suite.Run(t, new(MarkdownTestSuite))
}