summaryrefslogtreecommitdiffstats
path: root/app/export_test.go
diff options
context:
space:
mode:
authorWasim Thabraze <wasim@thabraze.me>2018-10-17 18:53:10 +0530
committerGeorge Goldberg <george@gberg.me>2018-10-17 14:23:10 +0100
commit7562f940bb7b0de80bcfb8f5c3fc1b751a1a6b16 (patch)
tree19ce5b4d1031887ea62865006f8b7ead892d543c /app/export_test.go
parent1befeb61d0299028d050a732ea9c8f7e8774ed74 (diff)
downloadchat-7562f940bb7b0de80bcfb8f5c3fc1b751a1a6b16.tar.gz
chat-7562f940bb7b0de80bcfb8f5c3fc1b751a1a6b16.tar.bz2
chat-7562f940bb7b0de80bcfb8f5c3fc1b751a1a6b16.zip
[MM-12465] Added capability to export reactions of posts during bulk export (#9600)
* Added capability to export reactions of posts * Added capability to export reactions of replies of a post * Added test case to test the reactions of a post
Diffstat (limited to 'app/export_test.go')
-rw-r--r--app/export_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/export_test.go b/app/export_test.go
new file mode 100644
index 000000000..05b81387a
--- /dev/null
+++ b/app/export_test.go
@@ -0,0 +1,32 @@
+package app
+
+import (
+ "github.com/stretchr/testify/assert"
+ "testing"
+
+ "github.com/mattermost/mattermost-server/model"
+)
+
+func TestReactionsOfPost(t *testing.T) {
+ th := Setup().InitBasic()
+ defer th.TearDown()
+
+ post := th.BasicPost
+ post.HasReactions = true
+
+ reactionObject := model.Reaction{
+ UserId: model.NewId(),
+ PostId: post.Id,
+ EmojiName: "emoji",
+ CreateAt: model.GetMillis(),
+ }
+
+ th.App.SaveReactionForPost(&reactionObject)
+ reactionsOfPost, err := th.App.BuildPostReactions(post.Id)
+
+ if err != nil {
+ t.Fatal("should have reactions")
+ }
+
+ assert.Equal(t, reactionObject.EmojiName, *(*reactionsOfPost)[0].EmojiName)
+}