summaryrefslogtreecommitdiffstats
path: root/model/reaction_test.go
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-04-26 23:11:32 +0900
committerHarrison Healey <harrisonmhealey@gmail.com>2017-04-26 10:11:32 -0400
commit6fa7082833812c734aeef8ad24477823ee766f1b (patch)
treebc70138ff3a71cfffcdf9fe20794735a87e478e7 /model/reaction_test.go
parentf9502ff14bbb31aa835540c14725bbebdf0c340d (diff)
downloadchat-6fa7082833812c734aeef8ad24477823ee766f1b.tar.gz
chat-6fa7082833812c734aeef8ad24477823ee766f1b.tar.bz2
chat-6fa7082833812c734aeef8ad24477823ee766f1b.zip
fix reaction's name validation with + sign in it (#6221)
Diffstat (limited to 'model/reaction_test.go')
-rw-r--r--model/reaction_test.go25
1 files changed, 15 insertions, 10 deletions
diff --git a/model/reaction_test.go b/model/reaction_test.go
index e447e4329..a35750477 100644
--- a/model/reaction_test.go
+++ b/model/reaction_test.go
@@ -42,16 +42,6 @@ func TestReactionIsValid(t *testing.T) {
}
reaction.PostId = NewId()
- reaction.EmojiName = ""
- if err := reaction.IsValid(); err == nil {
- t.Fatal("emoji name should be invalid")
- }
-
- reaction.EmojiName = strings.Repeat("a", 65)
- if err := reaction.IsValid(); err == nil {
- t.Fatal("emoji name should be invalid")
- }
-
reaction.EmojiName = strings.Repeat("a", 64)
if err := reaction.IsValid(); err != nil {
t.Fatal(err)
@@ -67,11 +57,26 @@ func TestReactionIsValid(t *testing.T) {
t.Fatal(err)
}
+ reaction.EmojiName = "+1"
+ if err := reaction.IsValid(); err != nil {
+ t.Fatal(err)
+ }
+
reaction.EmojiName = "emoji:"
if err := reaction.IsValid(); err == nil {
t.Fatal(err)
}
+ reaction.EmojiName = ""
+ if err := reaction.IsValid(); err == nil {
+ t.Fatal("emoji name should be invalid")
+ }
+
+ reaction.EmojiName = strings.Repeat("a", 65)
+ if err := reaction.IsValid(); err == nil {
+ t.Fatal("emoji name should be invalid")
+ }
+
reaction.CreateAt = 0
if err := reaction.IsValid(); err == nil {
t.Fatal("create at should be invalid")