summaryrefslogtreecommitdiffstats
path: root/model/post_test.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-11-28 15:02:56 -0600
committerChristopher Speller <crspeller@gmail.com>2017-11-28 13:02:56 -0800
commitb87fae646a624507f5b2c1270cae1d3585f589ac (patch)
treed81b683cda11b08ed04d7e2431b04a84a715d851 /model/post_test.go
parent27ba68a7894d5204b8d75dc7353774977d62fa15 (diff)
downloadchat-b87fae646a624507f5b2c1270cae1d3585f589ac.tar.gz
chat-b87fae646a624507f5b2c1270cae1d3585f589ac.tar.bz2
chat-b87fae646a624507f5b2c1270cae1d3585f589ac.zip
PLT-5458: If someone posts a channel link to channel_A that you don't belong to, it doesn't render properly (#7833)
* add channel link hints to post props * optimization * update regex, add unit test * fix rebase issue
Diffstat (limited to 'model/post_test.go')
-rw-r--r--model/post_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/model/post_test.go b/model/post_test.go
index 846c8c775..6a908887d 100644
--- a/model/post_test.go
+++ b/model/post_test.go
@@ -6,6 +6,8 @@ package model
import (
"strings"
"testing"
+
+ "github.com/stretchr/testify/assert"
)
func TestPostJson(t *testing.T) {
@@ -124,6 +126,11 @@ func TestPostIsSystemMessage(t *testing.T) {
}
}
+func TestPostChannelMentions(t *testing.T) {
+ post := Post{Message: "~a ~b ~b ~c/~d."}
+ assert.Equal(t, []string{"a", "b", "c", "d"}, post.ChannelMentions())
+}
+
func TestPostSanitizeProps(t *testing.T) {
post1 := &Post{
Message: "test",