diff options
author | Maksim Pechnikov <parallel588@gmail.com> | 2019-11-15 22:10:41 +0300 |
---|---|---|
committer | Maksim Pechnikov <parallel588@gmail.com> | 2019-11-15 22:46:58 +0300 |
commit | b9041c209787dc279d4dc5194d65dff73684cdb9 (patch) | |
tree | 927fab2c4c2577da9c1cafb1c3d95efcdff302b5 /test | |
parent | b5b62f42b2864dc8b95c8ba7d650321ebcc332ad (diff) | |
download | pleroma-b9041c209787dc279d4dc5194d65dff73684cdb9.tar.gz |
added recount unread notifications to markers
Diffstat (limited to 'test')
-rw-r--r-- | test/marker_test.exs | 14 | ||||
-rw-r--r-- | test/web/mastodon_api/controllers/marker_controller_test.exs | 3 |
2 files changed, 16 insertions, 1 deletions
diff --git a/test/marker_test.exs b/test/marker_test.exs index 5d03db48e..7b1d2218a 100644 --- a/test/marker_test.exs +++ b/test/marker_test.exs @@ -36,6 +36,20 @@ defmodule Pleroma.MarkerTest do insert(:marker, timeline: "home", user: user) assert Marker.get_markers(user, ["notifications"]) == [refresh_record(marker)] end + + test "returns user markers with recount unread notifications" do + user = insert(:user) + marker = insert(:marker, user: user) + insert(:notification, user: user) + insert(:notification, user: user) + insert(:marker, timeline: "home", user: user) + + assert Marker.get_markers( + user, + ["notifications"], + %{recount_unread: true} + ) == [%Marker{refresh_record(marker) | unread_count: 2}] + end end describe "upsert/2" do diff --git a/test/web/mastodon_api/controllers/marker_controller_test.exs b/test/web/mastodon_api/controllers/marker_controller_test.exs index 8bcfcb7e1..64bf79bb1 100644 --- a/test/web/mastodon_api/controllers/marker_controller_test.exs +++ b/test/web/mastodon_api/controllers/marker_controller_test.exs @@ -11,11 +11,12 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do test "gets markers with correct scopes", %{conn: conn} do user = insert(:user) token = insert(:oauth_token, user: user, scopes: ["read:statuses"]) + insert_list(7, :notification, user: user) {:ok, %{"notifications" => marker}} = Pleroma.Marker.upsert( user, - %{"notifications" => %{"last_read_id" => "69420", "unread_count" => 7}} + %{"notifications" => %{"last_read_id" => "69420"}} ) response = |