diff options
author | Saturnino Abril <saturnino.abril@gmail.com> | 2017-08-31 04:29:32 +0800 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-08-30 16:29:32 -0400 |
commit | f34cd567a6332fe53dae27e6b99b4382505de7a1 (patch) | |
tree | e0d32d1fd51930122e8b18408fba5f30a858780c /api/command_test.go | |
parent | bb2ca558bb8a015ff850aa3887cbbfdc4e14650d (diff) | |
download | chat-f34cd567a6332fe53dae27e6b99b4382505de7a1.tar.gz chat-f34cd567a6332fe53dae27e6b99b4382505de7a1.tar.bz2 chat-f34cd567a6332fe53dae27e6b99b4382505de7a1.zip |
[PLT-5170] Add join the channel system message for the person who created the channel (#7299)
* add join the channel system message for the person who created the channel
* update test
Diffstat (limited to 'api/command_test.go')
-rw-r--r-- | api/command_test.go | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/api/command_test.go b/api/command_test.go index bc8aca6aa..0d575d702 100644 --- a/api/command_test.go +++ b/api/command_test.go @@ -4,6 +4,7 @@ package api import ( + "strings" "testing" "time" @@ -256,9 +257,22 @@ func TestTestCommand(t *testing.T) { time.Sleep(100 * time.Millisecond) - p1 := Client.Must(Client.GetPosts(channel1.Id, 0, 2, "")).Data.(*model.PostList) - if len(p1.Order) != 1 { - t.Fatal("Test command failed to send") + p1 := Client.Must(Client.GetPosts(channel1.Id, 0, 10, "")).Data.(*model.PostList) + // including system 'joined' message + if len(p1.Order) != 2 { + t.Fatal("Test command response failed to send") + } + + cmdPosted := false + for _, post := range p1.Posts { + if strings.Contains(post.Message, "test command response") { + cmdPosted = true + break + } + } + + if !cmdPosted { + t.Fatal("Test command response failed to post") } cmd2 := &model.Command{ @@ -276,8 +290,8 @@ func TestTestCommand(t *testing.T) { time.Sleep(100 * time.Millisecond) - p2 := Client.Must(Client.GetPosts(channel1.Id, 0, 2, "")).Data.(*model.PostList) - if len(p2.Order) != 2 { + p2 := Client.Must(Client.GetPosts(channel1.Id, 0, 10, "")).Data.(*model.PostList) + if len(p2.Order) != 3 { t.Fatal("Test command failed to send") } } |