diff options
Diffstat (limited to 'test/web')
| -rw-r--r-- | test/web/mastodon_api/controllers/notification_controller_test.exs | 27 | ||||
| -rw-r--r-- | test/web/mastodon_api/views/notification_view_test.exs | 4 | 
2 files changed, 28 insertions, 3 deletions
| diff --git a/test/web/mastodon_api/controllers/notification_controller_test.exs b/test/web/mastodon_api/controllers/notification_controller_test.exs index 698c99711..70ef0e8b5 100644 --- a/test/web/mastodon_api/controllers/notification_controller_test.exs +++ b/test/web/mastodon_api/controllers/notification_controller_test.exs @@ -313,6 +313,33 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do        assert public_activity.id in activity_ids        refute unlisted_activity.id in activity_ids      end + +    test "doesn't return less than the requested amount of records when the user's reply is liked" do +      user = insert(:user) +      %{user: other_user, conn: conn} = oauth_access(["read:notifications"]) + +      {:ok, mention} = +        CommonAPI.post(user, %{status: "@#{other_user.nickname}", visibility: "public"}) + +      {:ok, activity} = CommonAPI.post(user, %{status: ".", visibility: "public"}) + +      {:ok, reply} = +        CommonAPI.post(other_user, %{ +          status: ".", +          visibility: "public", +          in_reply_to_status_id: activity.id +        }) + +      {:ok, _favorite} = CommonAPI.favorite(user, reply.id) + +      activity_ids = +        conn +        |> get("/api/v1/notifications?exclude_visibilities[]=direct&limit=2") +        |> json_response_and_validate_schema(200) +        |> Enum.map(& &1["status"]["id"]) + +      assert [reply.id, mention.id] == activity_ids +    end    end    test "filters notifications using exclude_types" do diff --git a/test/web/mastodon_api/views/notification_view_test.exs b/test/web/mastodon_api/views/notification_view_test.exs index b2fa5b302..9c399b2df 100644 --- a/test/web/mastodon_api/views/notification_view_test.exs +++ b/test/web/mastodon_api/views/notification_view_test.exs @@ -139,9 +139,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do      test_notifications_rendering([notification], followed, [expected])      User.perform(:delete, follower) -    notification = Notification |> Repo.one() |> Repo.preload(:activity) - -    test_notifications_rendering([notification], followed, []) +    refute Repo.one(Notification)    end    @tag capture_log: true | 
