Fix TestSendNotifications test (#8712)

Этот коммит содержится в:
Jesús Espino
2018-05-03 15:40:54 +02:00
коммит произвёл Harrison Healey
родитель 62898f4892
Коммит ffb834ec3c
2 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@@ -37,7 +37,7 @@ func TestSendNotifications(t *testing.T) {
} else if mentions == nil { } else if mentions == nil {
t.Log(mentions) t.Log(mentions)
t.Fatal("user should have been mentioned") t.Fatal("user should have been mentioned")
} else if mentions[0] != th.BasicUser2.Id { } else if !utils.StringInSlice(th.BasicUser2.Id, mentions) {
t.Log(mentions) t.Log(mentions)
t.Fatal("user should have been mentioned") t.Fatal("user should have been mentioned")
} }

Просмотреть файл

@@ -13,6 +13,15 @@ import (
"github.com/mattermost/mattermost-server/model" "github.com/mattermost/mattermost-server/model"
) )
func StringInSlice(a string, slice []string) bool {
for _, b := range slice {
if b == a {
return true
}
}
return false
}
func StringArrayIntersection(arr1, arr2 []string) []string { func StringArrayIntersection(arr1, arr2 []string) []string {
arrMap := map[string]bool{} arrMap := map[string]bool{}
result := []string{} result := []string{}