2018-05-24 20:14:49 -07:00
|
|
|
defmodule Pleroma.Web.CommonAPI.Test do
|
2018-05-23 08:25:24 -07:00
|
|
|
use Pleroma.DataCase
|
|
|
|
alias Pleroma.Web.CommonAPI
|
2018-08-12 12:24:10 -07:00
|
|
|
alias Pleroma.User
|
2018-05-23 08:25:24 -07:00
|
|
|
|
|
|
|
import Pleroma.Factory
|
|
|
|
|
|
|
|
test "it de-duplicates tags" do
|
|
|
|
user = insert(:user)
|
|
|
|
{:ok, activity} = CommonAPI.post(user, %{"status" => "#2hu #2HU"})
|
|
|
|
|
|
|
|
assert activity.data["object"]["tag"] == ["2hu"]
|
|
|
|
end
|
2018-08-12 12:24:10 -07:00
|
|
|
|
|
|
|
test "it adds emoji when updating profiles" do
|
|
|
|
user = insert(:user, %{name: ":karjalanpiirakka:"})
|
|
|
|
|
|
|
|
CommonAPI.update(user)
|
|
|
|
user = User.get_cached_by_ap_id(user.ap_id)
|
|
|
|
[karjalanpiirakka] = user.info["source_data"]["tag"]
|
|
|
|
|
|
|
|
assert karjalanpiirakka["name"] == ":karjalanpiirakka:"
|
|
|
|
end
|
2018-05-23 08:25:24 -07:00
|
|
|
end
|