From 0cbba46018d3879234d3940e8ee6f23dd99a1c5a Mon Sep 17 00:00:00 2001 From: Stephen Kiers Date: Mon, 12 Feb 2018 16:30:03 -0700 Subject: Fixes ICU-764 --- app/notification_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'app/notification_test.go') diff --git a/app/notification_test.go b/app/notification_test.go index 11f4df685..7f2a63ab9 100644 --- a/app/notification_test.go +++ b/app/notification_test.go @@ -109,6 +109,15 @@ func TestGetExplicitMentions(t *testing.T) { }, }, }, + "OnePersonAtEndOfSentence": { + Message: "this is a message for @user.", + Keywords: map[string][]string{"@user": {id1}}, + Expected: &ExplicitMentions{ + MentionedUserIds: map[string]bool{ + id1: true, + }, + }, + }, "OnePersonWithoutAtMention": { Message: "this is a message for @user", Keywords: map[string][]string{"this": {id1}}, @@ -179,6 +188,15 @@ func TestGetExplicitMentions(t *testing.T) { }, }, }, + "UserWithPeriodAtEndOfSentence": { + Message: "this is a message for user.period.", + Keywords: map[string][]string{"user.period": {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}}, -- cgit v1.2.3-1-g7c22 From bdf478c75bb41c00cdfd47bd7ae68c70a06886af Mon Sep 17 00:00:00 2001 From: Stephen Kiers Date: Mon, 12 Feb 2018 20:50:20 -0700 Subject: Added another test --- app/notification_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'app/notification_test.go') diff --git a/app/notification_test.go b/app/notification_test.go index 7f2a63ab9..61442c048 100644 --- a/app/notification_test.go +++ b/app/notification_test.go @@ -188,6 +188,15 @@ func TestGetExplicitMentions(t *testing.T) { }, }, }, + "AtUserWithPeriodAtEndOfSentence": { + Message: "this is a message for @user.period.", + Keywords: map[string][]string{"@user.period": {id1}}, + Expected: &ExplicitMentions{ + MentionedUserIds: map[string]bool{ + id1: true, + }, + }, + }, "UserWithPeriodAtEndOfSentence": { Message: "this is a message for user.period.", Keywords: map[string][]string{"user.period": {id1}}, -- cgit v1.2.3-1-g7c22 From 08c21f75199f959bbe63396be246e2b7d36a9a39 Mon Sep 17 00:00:00 2001 From: Stephen Kiers Date: Tue, 13 Feb 2018 10:49:48 -0700 Subject: Added more tests and simplified code --- app/notification_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'app/notification_test.go') diff --git a/app/notification_test.go b/app/notification_test.go index 61442c048..bd7da3db7 100644 --- a/app/notification_test.go +++ b/app/notification_test.go @@ -109,6 +109,24 @@ func TestGetExplicitMentions(t *testing.T) { }, }, }, + "OnePersonWithPeriodAtEndOfUsername": { + Message: "this is a message for @user.name.", + Keywords: map[string][]string{"@user.name.": {id1}}, + Expected: &ExplicitMentions{ + MentionedUserIds: map[string]bool{ + id1: true, + }, + }, + }, + "OnePersonWithPeriodAtEndOfUsernameButNotSimilarName": { + Message: "this is a message for @user.name.", + Keywords: map[string][]string{"@user.name.": {id1}, "@user.name": {id2}}, + Expected: &ExplicitMentions{ + MentionedUserIds: map[string]bool{ + id1: true, + }, + }, + }, "OnePersonAtEndOfSentence": { Message: "this is a message for @user.", Keywords: map[string][]string{"@user": {id1}}, -- cgit v1.2.3-1-g7c22