summaryrefslogtreecommitdiff
path: root/internal/text/link_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-08-25 15:34:33 +0200
committerLibravatar GitHub <noreply@github.com>2021-08-25 15:34:33 +0200
commit2dc9fc1626507bb54417fc4a1920b847cafb27a2 (patch)
tree4ddeac479b923db38090aac8bd9209f3646851c1 /internal/text/link_test.go
parentManually approves followers (#146) (diff)
downloadgotosocial-2dc9fc1626507bb54417fc4a1920b847cafb27a2.tar.xz
Pg to bun (#148)
* start moving to bun * changing more stuff * more * and yet more * tests passing * seems stable now * more big changes * small fix * little fixes
Diffstat (limited to 'internal/text/link_test.go')
-rw-r--r--internal/text/link_test.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/internal/text/link_test.go b/internal/text/link_test.go
index 83c42f045..f8d6a1adc 100644
--- a/internal/text/link_test.go
+++ b/internal/text/link_test.go
@@ -19,6 +19,7 @@
package text_test
import (
+ "context"
"testing"
"github.com/stretchr/testify/assert"
@@ -94,7 +95,7 @@ func (suite *LinkTestSuite) TearDownTest() {
}
func (suite *LinkTestSuite) TestParseSimple() {
- f := suite.formatter.FromPlain(simple, nil, nil)
+ f := suite.formatter.FromPlain(context.Background(), simple, nil, nil)
assert.Equal(suite.T(), simpleExpected, f)
}
@@ -126,7 +127,7 @@ func (suite *LinkTestSuite) TestParseURLsFromText3() {
}
func (suite *LinkTestSuite) TestReplaceLinksFromText1() {
- replaced := suite.formatter.ReplaceLinks(text1)
+ replaced := suite.formatter.ReplaceLinks(context.Background(), text1)
assert.Equal(suite.T(), `
This is a text with some links in it. Here's link number one: <a href="https://example.org/link/to/something#fragment" rel="noopener">example.org/link/to/something#fragment</a>
@@ -141,7 +142,7 @@ really.cool.website <-- this one shouldn't be parsed as a link because it doesn'
}
func (suite *LinkTestSuite) TestReplaceLinksFromText2() {
- replaced := suite.formatter.ReplaceLinks(text2)
+ replaced := suite.formatter.ReplaceLinks(context.Background(), text2)
assert.Equal(suite.T(), `
this is one link: <a href="https://example.org" rel="noopener">example.org</a>
@@ -153,14 +154,14 @@ these should be deduplicated
func (suite *LinkTestSuite) TestReplaceLinksFromText3() {
// we know mailto links won't be replaced with hrefs -- we only accept https and http
- replaced := suite.formatter.ReplaceLinks(text3)
+ replaced := suite.formatter.ReplaceLinks(context.Background(), text3)
assert.Equal(suite.T(), `
here's a mailto link: mailto:whatever@test.org
`, replaced)
}
func (suite *LinkTestSuite) TestReplaceLinksFromText4() {
- replaced := suite.formatter.ReplaceLinks(text4)
+ replaced := suite.formatter.ReplaceLinks(context.Background(), text4)
assert.Equal(suite.T(), `
two similar links:
@@ -172,7 +173,7 @@ two similar links:
func (suite *LinkTestSuite) TestReplaceLinksFromText5() {
// we know this one doesn't work properly, which is why html should always be sanitized before being passed into the ReplaceLinks function
- replaced := suite.formatter.ReplaceLinks(text5)
+ replaced := suite.formatter.ReplaceLinks(context.Background(), text5)
assert.Equal(suite.T(), `
what happens when we already have a link within an href?