mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* 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
33 lines
647 B
Go
33 lines
647 B
Go
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)
|
|
}
|