1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.MarkerTest do
11 describe "get_markers/2" do
12 test "returns user markers" do
14 marker = insert(:marker, user: user)
15 insert(:marker, timeline: "home", user: user)
16 assert Marker.get_markers(user, ["notifications"]) == [refresh_record(marker)]
20 describe "upsert/2" do
21 test "creates a marker" do
24 {:ok, %{"notifications" => %Marker{} = marker}} =
27 %{"notifications" => %{"last_read_id" => "34"}}
30 assert marker.timeline == "notifications"
31 assert marker.last_read_id == "34"
32 assert marker.lock_version == 0
35 test "updates exist marker" do
37 marker = insert(:marker, user: user, last_read_id: "8909")
39 {:ok, %{"notifications" => %Marker{}}} =
42 %{"notifications" => %{"last_read_id" => "9909"}}
45 marker = refresh_record(marker)
46 assert marker.timeline == "notifications"
47 assert marker.last_read_id == "9909"
48 assert marker.lock_version == 0