mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-43252] Fix flaky TestPreparePostListForClient (#24407)
* Fix flaky TestPreparePostListForClient * Ignore order of returned elements * Revert timeout increase
This commit is contained in:
parent
bac317dfe5
commit
2c893d8c05
@ -66,7 +66,6 @@ func TestPreparePostListForClient(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPreparePostForClient(t *testing.T) {
|
||||
t.Skip("MM-43252")
|
||||
var serverURL string
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
@ -169,14 +168,13 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
reaction1 := th.AddReactionToPost(post, th.BasicUser, "smile")
|
||||
reaction2 := th.AddReactionToPost(post, th.BasicUser2, "smile")
|
||||
reaction3 := th.AddReactionToPost(post, th.BasicUser2, "ice_cream")
|
||||
reactions := []*model.Reaction{reaction1, reaction2, reaction3}
|
||||
post.HasReactions = true
|
||||
|
||||
clientPost := th.App.PreparePostForClient(th.Context, post, false, false, false)
|
||||
|
||||
assert.Len(t, clientPost.Metadata.Reactions, 3, "should've populated Reactions")
|
||||
assert.Equal(t, reaction1, clientPost.Metadata.Reactions[0], "first reaction is incorrect")
|
||||
assert.Equal(t, reaction2, clientPost.Metadata.Reactions[1], "second reaction is incorrect")
|
||||
assert.Equal(t, reaction3, clientPost.Metadata.Reactions[2], "third reaction is incorrect")
|
||||
assert.ElementsMatch(t, reactions, clientPost.Metadata.Reactions)
|
||||
})
|
||||
|
||||
t.Run("files", func(t *testing.T) {
|
||||
@ -185,6 +183,7 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
|
||||
fileInfo, err := th.App.DoUploadFile(th.Context, time.Now(), th.BasicTeam.Id, th.BasicChannel.Id, th.BasicUser.Id, "test.txt", []byte("test"))
|
||||
fileInfo.Content = "test"
|
||||
fileInfo.ChannelId = th.BasicChannel.Id
|
||||
require.Nil(t, err)
|
||||
|
||||
post, err := th.App.CreatePost(th.Context, &model.Post{
|
||||
|
Loading…
Reference in New Issue
Block a user