summaryrefslogtreecommitdiff
path: root/test/pleroma/web/mastodon_api/views/account_view_test.exs
diff options
context:
space:
mode:
Diffstat (limited to 'test/pleroma/web/mastodon_api/views/account_view_test.exs')
-rw-r--r--test/pleroma/web/mastodon_api/views/account_view_test.exs34
1 files changed, 34 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 c23ffb966..9fc56f7f0 100644
--- a/test/pleroma/web/mastodon_api/views/account_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs
@@ -494,6 +494,40 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
end
end
+ describe "hiding birthday" do
+ test "doesn't show birthday if hidden" do
+ user =
+ insert(:user, %{
+ birthday: "2001-02-12",
+ show_birthday: false
+ })
+
+ other_user = insert(:user)
+
+ user = User.get_cached_by_ap_id(user.ap_id)
+
+ assert AccountView.render(
+ "show.json",
+ %{user: user, for: other_user}
+ )[:birthday] == nil
+ end
+
+ test "shows hidden birthday to the account owner" do
+ user =
+ insert(:user, %{
+ birthday: "2001-02-12",
+ show_birthday: false
+ })
+
+ user = User.get_cached_by_ap_id(user.ap_id)
+
+ assert AccountView.render(
+ "show.json",
+ %{user: user, for: user}
+ )[:birthday] == nil
+ end
+ end
+
describe "follow requests counter" do
test "shows zero when no follow requests are pending" do
user = insert(:user)