summaryrefslogtreecommitdiffstats
path: root/model/search_params_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-01-27 07:38:10 -0500
committerJoram Wilander <jwawilander@gmail.com>2016-01-27 07:38:10 -0500
commite5ed90821e6bb25c27e5627cf289df41cbcb1793 (patch)
tree98446b1586e29afbedb92f9a63446d12a72f8b83 /model/search_params_test.go
parentefc4d239e14707de27b149b76f1dd4065838410c (diff)
parent97ede2a428faf3a62ce0140e51ed591e261c09a1 (diff)
downloadchat-e5ed90821e6bb25c27e5627cf289df41cbcb1793.tar.gz
chat-e5ed90821e6bb25c27e5627cf289df41cbcb1793.tar.bz2
chat-e5ed90821e6bb25c27e5627cf289df41cbcb1793.zip
Merge pull request #1984 from hmhealey/plt1103
PLT-1103 Updated serverside hashtag regex to ignore more punctuation around words
Diffstat (limited to 'model/search_params_test.go')
-rw-r--r--model/search_params_test.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/model/search_params_test.go b/model/search_params_test.go
index af4cbe595..59eb0a113 100644
--- a/model/search_params_test.go
+++ b/model/search_params_test.go
@@ -118,19 +118,19 @@ func TestParseSearchFlags(t *testing.T) {
t.Fatalf("got incorrect flags %v", flags)
}
- if words, flags := parseSearchFlags(splitWords("fruit: cherry")); len(words) != 2 || words[0] != "fruit:" || words[1] != "cherry" {
+ if words, flags := parseSearchFlags(splitWords("fruit: cherry")); len(words) != 2 || words[0] != "fruit" || words[1] != "cherry" {
t.Fatalf("got incorrect words %v", words)
} else if len(flags) != 0 {
t.Fatalf("got incorrect flags %v", flags)
}
- if words, flags := parseSearchFlags(splitWords("channel:")); len(words) != 1 || words[0] != "channel:" {
+ if words, flags := parseSearchFlags(splitWords("channel:")); len(words) != 1 || words[0] != "channel" {
t.Fatalf("got incorrect words %v", words)
} else if len(flags) != 0 {
t.Fatalf("got incorrect flags %v", flags)
}
- if words, flags := parseSearchFlags(splitWords("channel: first in: second from:")); len(words) != 1 || words[0] != "from:" {
+ if words, flags := parseSearchFlags(splitWords("channel: first in: second from:")); len(words) != 1 || words[0] != "from" {
t.Fatalf("got incorrect words %v", words)
} else if len(flags) != 2 || flags[0][0] != "channel" || flags[0][1] != "first" || flags[1][0] != "in" || flags[1][1] != "second" {
t.Fatalf("got incorrect flags %v", flags)
@@ -212,4 +212,8 @@ func TestParseSearchParams(t *testing.T) {
if sp := ParseSearchParams("testing in:channel from:someone"); len(sp) != 1 || sp[0].Terms != "testing" || len(sp[0].InChannels) != 1 || sp[0].InChannels[0] != "channel" || len(sp[0].FromUsers) != 1 || sp[0].FromUsers[0] != "someone" {
t.Fatalf("Incorrect output from parse search params: %v", sp[0])
}
+
+ if sp := ParseSearchParams("##hashtag +#plus+"); len(sp) != 1 || sp[0].Terms != "#hashtag #plus" || sp[0].IsHashtag != true || len(sp[0].InChannels) != 0 || len(sp[0].FromUsers) != 0 {
+ t.Fatalf("Incorrect output from parse search params: %v", sp[0])
+ }
}