X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fnotification_test.exs;h=80fa5231214d903acbed66d0c1f4d8f15e497981;hb=cd2df734dde6151faa6a73edb296a5cf768e9a34;hp=e12418db3cda85fe9bff09b3343473665bcb7dc4;hpb=c75840f7b8a117e973713c8cb47523f09deaab79;p=akkoma diff --git a/test/notification_test.exs b/test/notification_test.exs index e12418db3..80fa52312 100644 --- a/test/notification_test.exs +++ b/test/notification_test.exs @@ -164,12 +164,13 @@ defmodule Pleroma.NotificationTest do user = insert(:user) task = Task.async(fn -> assert_receive {:text, _}, 4_000 end) task_user_notification = Task.async(fn -> assert_receive {:text, _}, 4_000 end) - Streamer.add_socket("user", %{transport_pid: task.pid, assigns: %{user: user}}) - Streamer.add_socket( - "user:notification", - %{transport_pid: task_user_notification.pid, assigns: %{user: user}} - ) + Streamer.get_topic_and_add_socket("user", %{transport_pid: task.pid, assigns: %{user: user}}) + + Streamer.get_topic_and_add_socket("user:notification", %{ + transport_pid: task_user_notification.pid, + assigns: %{user: user} + }) activity = insert(:note_activity) @@ -445,8 +446,7 @@ defmodule Pleroma.NotificationTest do "status" => "hey again @#{other_user.nickname}!" }) - [n2, n1] = notifs = Notification.for_user(other_user) - assert length(notifs) == 2 + [n2, n1] = Notification.for_user(other_user) assert n2.id > n1.id @@ -455,7 +455,9 @@ defmodule Pleroma.NotificationTest do "status" => "hey yet again @#{other_user.nickname}!" }) - Notification.set_read_up_to(other_user, n2.id) + [_, read_notification] = Notification.set_read_up_to(other_user, n2.id) + + assert read_notification.activity.object [n3, n2, n1] = Notification.for_user(other_user) @@ -884,7 +886,9 @@ defmodule Pleroma.NotificationTest do {:ok, _activity} = CommonAPI.post(muted, %{"status" => "hey @#{user.nickname}"}) - assert length(Notification.for_user(user)) == 1 + [notification] = Notification.for_user(user) + + assert notification.activity.object end test "it doesn't return notifications for muted user with notifications" do