summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/formatter_test.exs4
-rw-r--r--test/user_test.exs2
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs27
-rw-r--r--test/web/twitter_api/twitter_api_controller_test.exs28
-rw-r--r--test/web/twitter_api/views/activity_view_test.exs2
-rw-r--r--test/web/twitter_api/views/user_view_test.exs2
6 files changed, 60 insertions, 5 deletions
diff --git a/test/formatter_test.exs b/test/formatter_test.exs
index fdaf29742..06f4f6e50 100644
--- a/test/formatter_test.exs
+++ b/test/formatter_test.exs
@@ -248,7 +248,7 @@ defmodule Pleroma.FormatterTest do
text = "I love :firefox:"
expected_result =
- "I love <img height=\"32px\" width=\"32px\" alt=\"firefox\" title=\"firefox\" src=\"/emoji/Firefox.gif\" />"
+ "I love <img class=\"emoji\" alt=\"firefox\" title=\"firefox\" src=\"/emoji/Firefox.gif\" />"
assert Formatter.emojify(text) == expected_result
end
@@ -263,7 +263,7 @@ defmodule Pleroma.FormatterTest do
}
expected_result =
- "I love <img height=\"32px\" width=\"32px\" alt=\"\" title=\"\" src=\"https://placehold.it/1x1\" />"
+ "I love <img class=\"emoji\" alt=\"\" title=\"\" src=\"https://placehold.it/1x1\" />"
assert Formatter.emojify(text, custom_emoji) == expected_result
end
diff --git a/test/user_test.exs b/test/user_test.exs
index 67266cb7a..6d21b56f7 100644
--- a/test/user_test.exs
+++ b/test/user_test.exs
@@ -1103,7 +1103,7 @@ defmodule Pleroma.UserTest do
expected_text =
"A.k.a. <span class='h-card'><a data-user='#{remote_user.id}' class='u-url mention' href='#{
remote_user.ap_id
- }'>" <> "@<span>nick@domain.com</span></a></span>"
+ }'>@<span>nick@domain.com</span></a></span>"
assert expected_text == User.parse_bio(bio, user)
end
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index c2a12d3c7..610aa486e 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -2351,6 +2351,33 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
end
end
end
+
+ test "updates profile emojos", %{conn: conn} do
+ user = insert(:user)
+
+ note = "*sips :blank:*"
+ name = "I am :firefox:"
+
+ conn =
+ conn
+ |> assign(:user, user)
+ |> patch("/api/v1/accounts/update_credentials", %{
+ "note" => note,
+ "display_name" => name
+ })
+
+ assert json_response(conn, 200)
+
+ conn =
+ conn
+ |> get("/api/v1/accounts/#{user.id}")
+
+ assert user = json_response(conn, 200)
+
+ assert user["note"] == note
+ assert user["display_name"] == name
+ assert [%{"shortcode" => "blank"}, %{"shortcode" => "firefox"}] = user["emojis"]
+ end
end
test "get instance information", %{conn: conn} do
diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs
index 43ad71a16..90718cfb4 100644
--- a/test/web/twitter_api/twitter_api_controller_test.exs
+++ b/test/web/twitter_api/twitter_api_controller_test.exs
@@ -1611,6 +1611,34 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
assert json_response(conn, 200) == UserView.render("user.json", %{user: user, for: user})
end
+
+ # Broken before the change to class="emoji" and non-<img/> in the DB
+ @tag :skip
+ test "it formats emojos", %{conn: conn} do
+ user = insert(:user)
+
+ conn =
+ conn
+ |> assign(:user, user)
+ |> post("/api/account/update_profile.json", %{
+ "bio" => "I love our :moominmamma:​"
+ })
+
+ assert response = json_response(conn, 200)
+
+ assert %{
+ "description" => "I love our :moominmamma:",
+ "description_html" =>
+ ~s{I love our <img class="emoji" alt="moominmamma" title="moominmamma" src="} <>
+ _
+ } = response
+
+ conn =
+ conn
+ |> get("/api/users/show.json?user_id=#{user.nickname}")
+
+ assert response == json_response(conn, 200)
+ end
end
defp valid_user(_context) do
diff --git a/test/web/twitter_api/views/activity_view_test.exs b/test/web/twitter_api/views/activity_view_test.exs
index 85815ba7e..1aa533b48 100644
--- a/test/web/twitter_api/views/activity_view_test.exs
+++ b/test/web/twitter_api/views/activity_view_test.exs
@@ -100,7 +100,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
expected = ":firefox: meow"
expected_html =
- "<img height=\"32px\" width=\"32px\" alt=\"firefox\" title=\"firefox\" src=\"http://localhost:4001/emoji/Firefox.gif\" /> meow"
+ "<img class=\"emoji\" alt=\"firefox\" title=\"firefox\" src=\"http://localhost:4001/emoji/Firefox.gif\" /> meow"
assert result["summary"] == expected
assert result["summary_html"] == expected_html
diff --git a/test/web/twitter_api/views/user_view_test.exs b/test/web/twitter_api/views/user_view_test.exs
index c99dbddeb..74526673c 100644
--- a/test/web/twitter_api/views/user_view_test.exs
+++ b/test/web/twitter_api/views/user_view_test.exs
@@ -32,7 +32,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
test "A user with emoji in username" do
expected =
- "<img height=\"32px\" width=\"32px\" alt=\"karjalanpiirakka\" title=\"karjalanpiirakka\" src=\"/file.png\" /> man"
+ "<img class=\"emoji\" alt=\"karjalanpiirakka\" title=\"karjalanpiirakka\" src=\"/file.png\" /> man"
user =
insert(:user, %{