Merge branch 'develop' into issue/1276
[akkoma] / test / web / mastodon_api / controllers / marker_controller_test.exs
index e0aacccb47c84fdc08106567460430323f4b7ea2..7280abd10137ff4b7e5249f55349599c0c710504 100644 (file)
@@ -1,5 +1,5 @@
 # Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
@@ -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 =
@@ -26,13 +27,13 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
         |> json_response(200)
 
       assert response == %{
-        "notifications" => %{
-          "last_read_id" => "69420",
-          "updated_at" => NaiveDateTime.to_iso8601(marker.updated_at),
-          "version" => 0,
-          "pleroma" => %{ "unread_count" => 7 }
-        }
-      }
+               "notifications" => %{
+                 "last_read_id" => "69420",
+                 "updated_at" => NaiveDateTime.to_iso8601(marker.updated_at),
+                 "version" => 0,
+                 "pleroma" => %{"unread_count" => 7}
+               }
+             }
     end
 
     test "gets markers with missed scopes", %{conn: conn} do
@@ -72,7 +73,7 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
                  "last_read_id" => "69420",
                  "updated_at" => _,
                  "version" => 0,
-                 "pleroma" => %{ "unread_count" => 0 }
+                 "pleroma" => %{"unread_count" => 0}
                }
              } = response
     end
@@ -102,7 +103,7 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
                  "last_read_id" => "69888",
                  "updated_at" => NaiveDateTime.to_iso8601(marker.updated_at),
                  "version" => 0,
-                 "pleroma" => %{ "unread_count" => 0 }
+                 "pleroma" => %{"unread_count" => 0}
                }
              }
     end