logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

marker_view_test.exs (1048B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Web.MastodonAPI.MarkerViewTest do
  5. use Pleroma.DataCase
  6. alias Pleroma.Web.MastodonAPI.MarkerView
  7. import Pleroma.Factory
  8. test "returns markers" do
  9. marker1 = insert(:marker, timeline: "notifications", last_read_id: "17", unread_count: 5)
  10. marker2 = insert(:marker, timeline: "home", last_read_id: "42")
  11. assert MarkerView.render("markers.json", %{markers: [marker1, marker2]}) == %{
  12. "home" => %{
  13. last_read_id: "42",
  14. updated_at: NaiveDateTime.to_iso8601(marker2.updated_at),
  15. version: 0,
  16. pleroma: %{unread_count: 0}
  17. },
  18. "notifications" => %{
  19. last_read_id: "17",
  20. updated_at: NaiveDateTime.to_iso8601(marker1.updated_at),
  21. version: 0,
  22. pleroma: %{unread_count: 5}
  23. }
  24. }
  25. end
  26. end