aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaksim Pechnikov <parallel588@gmail.com>2020-02-10 09:01:45 +0300
committerMaksim Pechnikov <parallel588@gmail.com>2020-02-10 09:01:45 +0300
commitcd040691bd28fea1437b8f1c39bb914465e1ff46 (patch)
tree0c0352880457073756a6f317f158286b7fddf852 /test
parentb87533760bb386e85eb8c806e1d242d2b1380971 (diff)
downloadpleroma-cd040691bd28fea1437b8f1c39bb914465e1ff46.tar.gz
maked `unread_count` as virtual field
Diffstat (limited to 'test')
-rw-r--r--test/marker_test.exs14
-rw-r--r--test/notification_test.exs5
2 files changed, 7 insertions, 12 deletions
diff --git a/test/marker_test.exs b/test/marker_test.exs
index 7b1d2218a..54c710691 100644
--- a/test/marker_test.exs
+++ b/test/marker_test.exs
@@ -15,7 +15,7 @@ defmodule Pleroma.MarkerTest do
assert %Ecto.Multi{
operations: [marker: {:run, _}, counters: {:run, _}]
} =
- Marker.multi_set_unread_count(
+ Marker.multi_set_last_read_id(
Ecto.Multi.new(),
user,
"notifications"
@@ -25,7 +25,7 @@ defmodule Pleroma.MarkerTest do
test "return empty multi" do
user = insert(:user)
multi = Ecto.Multi.new()
- assert Marker.multi_set_unread_count(multi, user, "home") == multi
+ assert Marker.multi_set_last_read_id(multi, user, "home") == multi
end
end
@@ -33,21 +33,13 @@ defmodule Pleroma.MarkerTest do
test "returns user markers" do
user = insert(:user)
marker = insert(:marker, user: user)
- 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}
+ ["notifications"]
) == [%Marker{refresh_record(marker) | unread_count: 2}]
end
end
diff --git a/test/notification_test.exs b/test/notification_test.exs
index c9b352097..49a79b2d3 100644
--- a/test/notification_test.exs
+++ b/test/notification_test.exs
@@ -338,12 +338,15 @@ defmodule Pleroma.NotificationTest do
assert n2.seen == true
assert n3.seen == false
- assert %Pleroma.Marker{unread_count: 1} =
+ assert %Pleroma.Marker{} =
+ m =
Pleroma.Repo.get_by(
Pleroma.Marker,
user_id: other_user.id,
timeline: "notifications"
)
+
+ assert m.last_read_id == to_string(n2.id)
end
end