Skip to content

Commit 5ff666c

Browse files
committed
Add test to check that reopened conversations get a converstationpart with part_type: "reopened"
1 parent 11ed661 commit 5ff666c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/lib/code_corps/messages/messages_test.exs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,23 @@ defmodule CodeCorps.MessagesTest do
242242
assert result.id == conversation.id
243243
end
244244
end
245+
246+
describe "update_conversation/2" do
247+
@reopened "reopned"
248+
249+
test "creates a conversation_part of part_type reopened when reopened" do
250+
conversation = insert(:conversation)
251+
252+
assert Repo.aggregate(ConversationPart, :count, :id) == 0
253+
254+
conversation = Messages.get_conversation(conversation.id)
255+
256+
updated = Messages.update_conversation(conversation,%{status: "reopened"})
257+
258+
assert Repo.aggregate(ConversationPart, :count, :id) == 1
259+
assert Repo.get_by(ConversationPart, part_type: "reopened")
260+
end
261+
end
245262

246263
describe "get_part/1" do
247264
test "gets a single part" do

0 commit comments

Comments
 (0)