diff options
author | Derrick Anderson <derrick@andersonwebstudio.com> | 2018-05-15 11:19:27 -0400 |
---|---|---|
committer | Derrick Anderson <derrick@andersonwebstudio.com> | 2018-05-15 11:19:27 -0400 |
commit | 228bc4bd1dc84bf741978711b680a06dd9d67613 (patch) | |
tree | 5dae4ebc13fca2749b4278bba772ec13c0924e03 /app/notification_test.go | |
parent | a1656dffa98fbc8865e476b214e4e0c562547d39 (diff) | |
parent | 9301e575c880970dc5642605adcc37903d176227 (diff) | |
download | chat-228bc4bd1dc84bf741978711b680a06dd9d67613.tar.gz chat-228bc4bd1dc84bf741978711b680a06dd9d67613.tar.bz2 chat-228bc4bd1dc84bf741978711b680a06dd9d67613.zip |
Merge remote-tracking branch 'origin/release-4.10' into merge410rc5
Diffstat (limited to 'app/notification_test.go')
-rw-r--r-- | app/notification_test.go | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/app/notification_test.go b/app/notification_test.go index 3b8b4adf5..818ad1d9d 100644 --- a/app/notification_test.go +++ b/app/notification_test.go @@ -148,6 +148,16 @@ func TestGetExplicitMentions(t *testing.T) { OtherPotentialMentions: []string{"user"}, }, }, + "OnePersonWithColonAtEnd": { + Message: "this is a message for @user:", + Keywords: map[string][]string{"this": {id1}}, + Expected: &ExplicitMentions{ + MentionedUserIds: map[string]bool{ + id1: true, + }, + OtherPotentialMentions: []string{"user"}, + }, + }, "MultiplePeopleWithOneWord": { Message: "this is a message for @user", Keywords: map[string][]string{"@user": {id1, id2}}, @@ -188,6 +198,18 @@ func TestGetExplicitMentions(t *testing.T) { ChannelMentioned: true, }, }, + + "ChannelWithColonAtEnd": { + Message: "this is a message for @channel:", + Keywords: map[string][]string{"@channel": {id1, id2}}, + Expected: &ExplicitMentions{ + MentionedUserIds: map[string]bool{ + id1: true, + id2: true, + }, + ChannelMentioned: true, + }, + }, "CapitalizedChannel": { Message: "this is an message for @cHaNNeL", Keywords: map[string][]string{"@channel": {id1, id2}}, @@ -210,6 +232,17 @@ func TestGetExplicitMentions(t *testing.T) { AllMentioned: true, }, }, + "AllWithColonAtEnd": { + Message: "this is a message for @all:", + Keywords: map[string][]string{"@all": {id1, id2}}, + Expected: &ExplicitMentions{ + MentionedUserIds: map[string]bool{ + id1: true, + id2: true, + }, + AllMentioned: true, + }, + }, "CapitalizedAll": { Message: "this is an message for @ALL", Keywords: map[string][]string{"@all": {id1, id2}}, @@ -230,6 +263,15 @@ func TestGetExplicitMentions(t *testing.T) { }, }, }, + "AtUserWithColonAtEnd": { + Message: "this is a message for @user:", + Keywords: map[string][]string{"@user": {id1}}, + Expected: &ExplicitMentions{ + MentionedUserIds: map[string]bool{ + id1: true, + }, + }, + }, "AtUserWithPeriodAtEndOfSentence": { Message: "this is a message for @user.period.", Keywords: map[string][]string{"@user.period": {id1}}, @@ -248,6 +290,15 @@ func TestGetExplicitMentions(t *testing.T) { }, }, }, + "UserWithColonAtEnd": { + Message: "this is a message for user:", + Keywords: map[string][]string{"user": {id1}}, + Expected: &ExplicitMentions{ + MentionedUserIds: map[string]bool{ + id1: true, + }, + }, + }, "PotentialOutOfChannelUser": { Message: "this is an message for @potential and @user", Keywords: map[string][]string{"@user": {id1}}, @@ -452,6 +503,7 @@ func TestGetExplicitMentionsAtHere(t *testing.T) { "\\@here\\": true, "|@here|": true, ";@here;": true, + "@here:": true, ":@here:": false, // This case shouldn't trigger a mention since it follows the format of reactions e.g. :word: "'@here'": true, "\"@here\"": true, |