Add test to validate URLs to custom emojis are properly encoded

This commit is contained in:
Mark Felder 2021-01-05 13:58:49 -06:00
parent 8864ac65c6
commit f9090e00e6

View file

@ -281,6 +281,21 @@ test "it can handle Listen activities" do
{:ok, _modified} = Transmogrifier.prepare_outgoing(activity.data) {:ok, _modified} = Transmogrifier.prepare_outgoing(activity.data)
end end
test "custom emoji urls are URI encoded" do
# :dinosaur: filename has a space -> dino walking.gif
user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{status: "everybody do the dinosaur :dinosaur:"})
{:ok, prepared} = Transmogrifier.prepare_outgoing(activity.data)
assert length(prepared["object"]["tag"]) == 1
url = prepared["object"]["tag"] |> List.first() |> Map.get("icon") |> Map.get("url")
assert url == "http://localhost:4001/emoji/dino%20walking.gif"
end
end end
describe "user upgrade" do describe "user upgrade" do