Skip to content
Snippets Groups Projects
Commit afe8fc6e authored by benjamin's avatar benjamin
Browse files

disabled the emoji check

parent 47a86422
No related branches found
No related tags found
1 merge request!510Release
......@@ -8,7 +8,6 @@
package channels
import (
"bytes"
"regexp"
)
......@@ -26,12 +25,12 @@ func ValidateReaction(reaction string) error {
return InvalidReaction
}
reader := bytes.NewReader([]byte(reaction))
// make sure it has emojis
if !compiledFindEmoji.MatchReader(reader) {
return InvalidReaction
}
/*
reader := bytes.NewReader([]byte(reaction))
// make sure it has emojis
if !compiledFindEmoji.MatchReader(reader) {
return InvalidReaction
}
*/
return nil
}
......@@ -7,10 +7,9 @@
package channels
import (
"testing"
)
import "testing"
/*
func TestValidateReaction(t *testing.T) {
testReactions := []string{"🍆", "😂", "❤", "🤣", "👍", "😭", "🙏", "😘", "🥰",
......@@ -25,6 +24,25 @@ func TestValidateReaction(t *testing.T) {
InvalidReaction, InvalidReaction, InvalidReaction, InvalidReaction,
InvalidReaction, InvalidReaction, InvalidReaction, InvalidReaction}
for i, r := range testReactions {
err := ValidateReaction(r)
if err != expected[i] {
t.Errorf("Got incorrect response for `%s` (%d): "+
"`%s` vs `%s`", r, i, err, expected[i])
}
}
}*/
func TestValidateReaction(t *testing.T) {
testReactions := []string{"🍆", "😂", "❤", "🤣", "👍", "😭", "🙏", "😘", "🥰",
"😍", "😊", "☺", "A", "b", "AA", "1", "🍆🍆", "🍆A", "👍👍👍", "👍😘A"}
expected := []error{
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, InvalidReaction, nil,
InvalidReaction, InvalidReaction, InvalidReaction, InvalidReaction}
for i, r := range testReactions {
err := ValidateReaction(r)
if err != expected[i] {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment