summaryrefslogtreecommitdiffstats
path: root/app/import_functions_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/import_functions_test.go')
-rw-r--r--app/import_functions_test.go54
1 files changed, 54 insertions, 0 deletions
diff --git a/app/import_functions_test.go b/app/import_functions_test.go
index e0859af45..fd8ae462e 100644
--- a/app/import_functions_test.go
+++ b/app/import_functions_test.go
@@ -1700,6 +1700,60 @@ func TestImportImportPost(t *testing.T) {
}
}
}
+
+ // Update post with replies.
+ data = &PostImportData{
+ Team: &teamName,
+ Channel: &channelName,
+ User: &user2.Username,
+ Message: ptrStr("Message with reply"),
+ CreateAt: &replyPostTime,
+ Replies: &[]ReplyImportData{{
+ User: &username,
+ Message: ptrStr("Message reply"),
+ CreateAt: &replyTime,
+ }},
+ }
+ if err := th.App.ImportPost(data, false); err != nil {
+ t.Fatalf("Expected success.")
+ }
+ AssertAllPostsCount(t, th.App, initialPostCount, 8, team.Id)
+
+ // Create new post with replies based on the previous one.
+ data = &PostImportData{
+ Team: &teamName,
+ Channel: &channelName,
+ User: &user2.Username,
+ Message: ptrStr("Message with reply 2"),
+ CreateAt: &replyPostTime,
+ Replies: &[]ReplyImportData{{
+ User: &username,
+ Message: ptrStr("Message reply"),
+ CreateAt: &replyTime,
+ }},
+ }
+ if err := th.App.ImportPost(data, false); err != nil {
+ t.Fatalf("Expected success.")
+ }
+ AssertAllPostsCount(t, th.App, initialPostCount, 10, team.Id)
+
+ // Create new reply for existing post with replies.
+ data = &PostImportData{
+ Team: &teamName,
+ Channel: &channelName,
+ User: &user2.Username,
+ Message: ptrStr("Message with reply"),
+ CreateAt: &replyPostTime,
+ Replies: &[]ReplyImportData{{
+ User: &username,
+ Message: ptrStr("Message reply 2"),
+ CreateAt: &replyTime,
+ }},
+ }
+ if err := th.App.ImportPost(data, false); err != nil {
+ t.Fatalf("Expected success.")
+ }
+ AssertAllPostsCount(t, th.App, initialPostCount, 11, team.Id)
}
func TestImportImportDirectChannel(t *testing.T) {