diff options
author | 2021-08-11 16:54:54 +0200 | |
---|---|---|
committer | 2021-08-11 16:54:54 +0200 | |
commit | 329a5e8144eea78e607c8a218ae78ae8f346f2e8 (patch) | |
tree | 73072075ad682212d77504d4199ae756f4950a60 /internal/util/statustools_test.go | |
parent | ahhh (diff) | |
download | gotosocial-329a5e8144eea78e607c8a218ae78ae8f346f2e8.tar.xz |
Text duplication fix (#137)
* start testing text duplication
* tests
* fixes + tests
Diffstat (limited to 'internal/util/statustools_test.go')
-rw-r--r-- | internal/util/statustools_test.go | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/internal/util/statustools_test.go b/internal/util/statustools_test.go index 5bdce2d5a..0ec2719f5 100644 --- a/internal/util/statustools_test.go +++ b/internal/util/statustools_test.go @@ -79,7 +79,7 @@ func (suite *StatusTestSuite) TestDeriveHashtagsOK() { assert.Equal(suite.T(), "testing123", tags[0]) assert.Equal(suite.T(), "also", tags[1]) assert.Equal(suite.T(), "thisshouldwork", tags[2]) - assert.Equal(suite.T(), "thisshouldalsowork", tags[3]) + assert.Equal(suite.T(), "ThisShouldAlsoWork", tags[3]) assert.Equal(suite.T(), "111111", tags[4]) } @@ -108,6 +108,26 @@ Here's some normal text with an :emoji: at the end assert.Equal(suite.T(), "underscores_ok_too", tags[6]) } +func (suite *StatusTestSuite) TestDeriveMultiple() { + statusText := `Another test @foss_satan@fossbros-anonymous.io + + #Hashtag + + Text` + + ms := util.DeriveMentionsFromStatus(statusText) + hs := util.DeriveHashtagsFromStatus(statusText) + es := util.DeriveEmojisFromStatus(statusText) + + assert.Len(suite.T(), ms, 1) + assert.Equal(suite.T(), "@foss_satan@fossbros-anonymous.io", ms[0]) + + assert.Len(suite.T(), hs, 1) + assert.Equal(suite.T(), "Hashtag", hs[0]) + + assert.Len(suite.T(), es, 0) +} + func TestStatusTestSuite(t *testing.T) { suite.Run(t, new(StatusTestSuite)) } |