+ test "it sends chat messages to the 'user:pleroma_chat' stream", %{user: user} do
+ other_user = insert(:user)
+
+ {:ok, create_activity} = CommonAPI.post_chat_message(other_user, user, "hey")
+ object = Object.normalize(create_activity, false)
+ Streamer.get_topic_and_add_socket("user:pleroma_chat", user)
+ Streamer.stream("user:pleroma_chat", object)
+ text = StreamerView.render("chat_update.json", object, user, [user.ap_id, other_user.ap_id])
+ assert_receive {:text, ^text}
+ end
+
+ test "it sends chat messages to the 'user' stream", %{user: user} do
+ other_user = insert(:user)
+
+ {:ok, create_activity} = CommonAPI.post_chat_message(other_user, user, "hey")
+ object = Object.normalize(create_activity, false)
+ Streamer.get_topic_and_add_socket("user", user)
+ Streamer.stream("user", object)
+ text = StreamerView.render("chat_update.json", object, user, [user.ap_id, other_user.ap_id])
+ assert_receive {:text, ^text}
+ end
+