summaryrefslogtreecommitdiffstats
path: root/app/notification_test.go
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2018-04-11 10:33:20 -0400
committerJoram Wilander <jwawilander@gmail.com>2018-04-11 10:33:20 -0400
commit2d0fef4d943198014913069d2b79a73f2e3a7d9a (patch)
tree5d7031dd6449e679cd9447c03d86372e182507c8 /app/notification_test.go
parent332411490ded04b66d3cf843a4f31ba64aeb6d6f (diff)
downloadchat-2d0fef4d943198014913069d2b79a73f2e3a7d9a.tar.gz
chat-2d0fef4d943198014913069d2b79a73f2e3a7d9a.tar.bz2
chat-2d0fef4d943198014913069d2b79a73f2e3a7d9a.zip
MM-10036 Ensured correct handling of capitalized special mentions (#8607)
Diffstat (limited to 'app/notification_test.go')
-rw-r--r--app/notification_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/notification_test.go b/app/notification_test.go
index 1abdd3d61..8df19e2bf 100644
--- a/app/notification_test.go
+++ b/app/notification_test.go
@@ -186,6 +186,17 @@ func TestGetExplicitMentions(t *testing.T) {
ChannelMentioned: true,
},
},
+ "CapitalizedChannel": {
+ Message: "this is an message for @cHaNNeL",
+ Keywords: map[string][]string{"@channel": {id1, id2}},
+ Expected: &ExplicitMentions{
+ MentionedUserIds: map[string]bool{
+ id1: true,
+ id2: true,
+ },
+ ChannelMentioned: true,
+ },
+ },
"All": {
Message: "this is an message for @all",
Keywords: map[string][]string{"@all": {id1, id2}},
@@ -197,6 +208,17 @@ func TestGetExplicitMentions(t *testing.T) {
AllMentioned: true,
},
},
+ "CapitalizedAll": {
+ Message: "this is an message for @ALL",
+ Keywords: map[string][]string{"@all": {id1, id2}},
+ Expected: &ExplicitMentions{
+ MentionedUserIds: map[string]bool{
+ id1: true,
+ id2: true,
+ },
+ AllMentioned: true,
+ },
+ },
"UserWithPeriod": {
Message: "user.period doesn't complicate things at all by including periods in their username",
Keywords: map[string][]string{"user.period": {id1}, "user": {id2}},
@@ -439,6 +461,8 @@ func TestGetExplicitMentionsAtHere(t *testing.T) {
"?@here?": true,
"`@here`": false, // This case shouldn't mention since it's a code block
"~@here~": true,
+ "@HERE": true,
+ "@hERe": true,
}
for message, shouldMention := range cases {