tests: add a testcase for matching osada users in the formatter
This commit is contained in:
parent
582dbe5c8d
commit
958c5e02e8
4 changed files with 147 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
defmodule Pleroma.FormatterTest do
|
||||
alias Pleroma.Formatter
|
||||
alias Pleroma.User
|
||||
use Pleroma.DataCase
|
||||
|
||||
import Pleroma.Factory
|
||||
|
|
@ -131,6 +132,24 @@ defmodule Pleroma.FormatterTest do
|
|||
assert expected_text == Formatter.finalize({subs, text})
|
||||
end
|
||||
|
||||
test "gives a replacement for user links when the user is using Osada" do
|
||||
mike = User.get_or_fetch("mike@osada.macgirvin.com")
|
||||
|
||||
text = "@mike@osada.macgirvin.com test"
|
||||
|
||||
mentions = Formatter.parse_mentions(text)
|
||||
|
||||
{subs, text} = Formatter.add_user_links({[], text}, mentions)
|
||||
|
||||
assert length(subs) == 1
|
||||
Enum.each(subs, fn {uuid, _} -> assert String.contains?(text, uuid) end)
|
||||
|
||||
expected_text =
|
||||
"<span><a class='mention' href='#{mike.ap_id}'>@<span>mike</span></a></span> test"
|
||||
|
||||
assert expected_text == Formatter.finalize({subs, text})
|
||||
end
|
||||
|
||||
test "gives a replacement for single-character local nicknames" do
|
||||
text = "@o hi"
|
||||
o = insert(:user, %{nickname: "o"})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue