aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcin mikołajczak <git@mkljczk.pl>2022-07-08 20:54:12 +0200
committermarcin mikołajczak <git@mkljczk.pl>2022-07-08 20:59:58 +0200
commit0b16ce79f91c0f7c99cf11567e29b1adb139ff35 (patch)
tree8813eb3fb40f88a2124d80457aa218b8e6985aa6
parentb0f83aea29be0b25075d19b35d5ff98ef8fbd000 (diff)
downloadpleroma-0b16ce79f91c0f7c99cf11567e29b1adb139ff35.tar.gz
Add test for rendering mute expiration date
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
-rw-r--r--test/pleroma/web/mastodon_api/views/account_view_test.exs17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/pleroma/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs
index 8ed37fe58..cc45ce4e9 100644
--- a/test/pleroma/web/mastodon_api/views/account_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs
@@ -634,4 +634,21 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|> assert()
end
end
+
+ test "renders mute expiration date" do
+ user = insert(:user)
+ other_user = insert(:user)
+
+ {:ok, _user_relationships} =
+ User.mute(user, other_user, %{notifications: true, expires_in: 24 * 60 * 60})
+
+ %{
+ mute_expires_at: mute_expires_at
+ } = AccountView.render("show.json", %{user: other_user, for: user, mutes: true})
+
+ assert NaiveDateTime.diff(
+ mute_expires_at,
+ NaiveDateTime.utc_now() |> NaiveDateTime.add(24 * 60 * 60)
+ ) in -3..3
+ end
end