Twitter API: Add tests for nil names.
authorscarlett <nia@netbsd.org>
Mon, 12 Nov 2018 16:40:34 +0000 (16:40 +0000)
committerscarlett <nia@netbsd.org>
Mon, 12 Nov 2018 17:02:01 +0000 (17:02 +0000)
test/web/twitter_api/views/user_view_test.exs

index 2deb22fb14c9dc942f37b3a92efa406ad3b7cb65..2c583c0d35a25cafb76567d0a85aa91b6006b980 100644 (file)
@@ -13,6 +13,13 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
     [user: user]
   end
 
+  test "A user with only a nickname", %{user: user} do
+    user = %{user | name: nil, nickname: "scarlett@catgirl.science"}
+    represented = UserView.render("show.json", %{user: user})
+    assert represented["name"] == user.nickname
+    assert represented["name_html"] == user.nickname
+  end
+
   test "A user with an avatar object", %{user: user} do
     image = "image"
     user = %{user | avatar: %{"url" => [%{"href" => image}]}}