blocker = Repo.get(User, blocker.id)
assert represented == UserView.render("show.json", %{user: user, for: blocker})
end
+
+ test "a user with mastodon fields" do
+ fields = [
+ %{
+ "name" => "Pronouns",
+ "value" => "she/her"
+ },
+ %{
+ "name" => "Website",
+ "value" => "https://example.org/"
+ }
+ ]
+
+ user =
+ insert(:user, %{
+ info: %{
+ "source_data" => %{
+ "attachment" =>
+ Enum.map(fields, fn field -> Map.put(field, "type", "PropertyValue") end)
+ }
+ }
+ })
+
+ userview = UserView.render("show.json", %{user: user})
+ assert userview["fields"] == fields
+ end
end