diff options
author | marcin mikołajczak <git@mkljczk.pl> | 2023-05-14 15:02:58 +0200 |
---|---|---|
committer | marcin mikołajczak <git@mkljczk.pl> | 2023-05-14 15:02:58 +0200 |
commit | 9363ef53a34c9d96191bccaece76dd4e01f493b6 (patch) | |
tree | 1da6534367a86864d9f6e39258edbfc36bdd9a22 | |
parent | 78d1105bffee7ece8a2b972d3cb58a6e41d86828 (diff) | |
download | pleroma-9363ef53a34c9d96191bccaece76dd4e01f493b6.tar.gz pleroma-9363ef53a34c9d96191bccaece76dd4e01f493b6.zip |
Add test for 'status' notification type for NotificationView
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
-rw-r--r-- | test/pleroma/web/mastodon_api/views/notification_view_test.exs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/pleroma/web/mastodon_api/views/notification_view_test.exs b/test/pleroma/web/mastodon_api/views/notification_view_test.exs index 6ea894691..92de6c6a7 100644 --- a/test/pleroma/web/mastodon_api/views/notification_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/notification_view_test.exs @@ -286,4 +286,31 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do test_notifications_rendering([notification], user, [expected]) end + + test "Subscribed status notification" do + user = insert(:user) + subscriber = insert(:user) + + User.subscribe(subscriber, user) + + {:ok, activity} = CommonAPI.post(user, %{status: "hi"}) + {:ok, [notification]} = Notification.create_notifications(activity) + + user = User.get_cached_by_id(user.id) + + expected = %{ + id: to_string(notification.id), + pleroma: %{is_seen: false, is_muted: false}, + type: "status", + account: + AccountView.render("show.json", %{ + user: user, + for: subscriber + }), + status: StatusView.render("show.json", %{activity: activity, for: subscriber}), + created_at: Utils.to_masto_date(notification.inserted_at) + } + + test_notifications_rendering([notification], subscriber, [expected]) + end end |