X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fnotification_test.exs;h=940913aa61bdc448d82f7efebfce36aa8a715b99;hb=081e8206ab75e336a76b621508b3999170159ec6;hp=1dbad34c167292d8bedf012e787cd952ea95e49a;hpb=b4b147000c224ffebe42264e6c60042f5b4c42b1;p=akkoma diff --git a/test/notification_test.exs b/test/notification_test.exs index 1dbad34c1..940913aa6 100644 --- a/test/notification_test.exs +++ b/test/notification_test.exs @@ -33,16 +33,16 @@ defmodule Pleroma.NotificationTest do assert other_notification.activity_id == activity.id end - test "it does not create a notification for subscribed users" do + test "it creates a notification for subscribed users" do user = insert(:user) subscriber = insert(:user) User.subscribe(subscriber, user) {:ok, status} = CommonAPI.post(user, %{"status" => "Akariiiin"}) - {:ok, notifications} = Notification.create_notifications(status) + {:ok, [notification]} = Notification.create_notifications(status) - assert notifications == [] + assert notification.user_id == subscriber.id end test "does not create a notification for subscribed users if status is a reply" do @@ -182,16 +182,14 @@ defmodule Pleroma.NotificationTest do refute Notification.create_notification(activity_dupe, followed_user) end - test "it doesn't create notifications for follow+subscribed users" do + test "it doesn't create duplicate notifications for follow+subscribed users" do user = insert(:user) subscriber = insert(:user) {:ok, _, _, _} = CommonAPI.follow(subscriber, user) User.subscribe(subscriber, user) {:ok, status} = CommonAPI.post(user, %{"status" => "Akariiiin"}) - {:ok, notifications} = Notification.create_notifications(status) - - assert notifications == [] + {:ok, [_notif]} = Notification.create_notifications(status) end test "it doesn't create subscription notifications if the recipient cannot see the status" do @@ -433,7 +431,7 @@ defmodule Pleroma.NotificationTest do "status" => "hey @#{other_user.nickname}!" }) - {:ok, activity_two, _} = CommonAPI.favorite(activity_one.id, third_user) + {:ok, activity_two} = CommonAPI.favorite(third_user, activity_one.id) assert other_user not in Notification.get_notified_from_activity(activity_two) end @@ -463,7 +461,7 @@ defmodule Pleroma.NotificationTest do assert Enum.empty?(Notification.for_user(user)) - {:ok, _, _} = CommonAPI.favorite(activity.id, other_user) + {:ok, _} = CommonAPI.favorite(other_user, activity.id) assert length(Notification.for_user(user)) == 1 @@ -480,7 +478,7 @@ defmodule Pleroma.NotificationTest do assert Enum.empty?(Notification.for_user(user)) - {:ok, _, _} = CommonAPI.favorite(activity.id, other_user) + {:ok, _} = CommonAPI.favorite(other_user, activity.id) assert length(Notification.for_user(user)) == 1 @@ -535,7 +533,7 @@ defmodule Pleroma.NotificationTest do assert Enum.empty?(Notification.for_user(user)) - {:error, _} = CommonAPI.favorite(activity.id, other_user) + {:error, _} = CommonAPI.favorite(other_user, activity.id) assert Enum.empty?(Notification.for_user(user)) end