[#413] fix parse mentions

This commit is contained in:
Maksim 2018-12-20 09:35:01 +00:00 committed by kaniini
commit f1b93b5be7
2 changed files with 16 additions and 9 deletions

View file

@ -215,8 +215,11 @@ defmodule Pleroma.FormatterTest do
end
test "it can parse mentions and return the relevant users" do
text = "@gsimg According to @archaeme, that is @daggsy. Also hello @archaeme@archae.me"
text =
"@@gsimg According to @archaeme, that is @daggsy. Also hello @archaeme@archae.me and @o and @@@jimm"
o = insert(:user, %{nickname: "o"})
jimm = insert(:user, %{nickname: "jimm"})
gsimg = insert(:user, %{nickname: "gsimg"})
archaeme = insert(:user, %{nickname: "archaeme"})
archaeme_remote = insert(:user, %{nickname: "archaeme@archae.me"})
@ -224,7 +227,9 @@ defmodule Pleroma.FormatterTest do
expected_result = [
{"@gsimg", gsimg},
{"@archaeme", archaeme},
{"@archaeme@archae.me", archaeme_remote}
{"@archaeme@archae.me", archaeme_remote},
{"@o", o},
{"@jimm", jimm}
]
assert Formatter.parse_mentions(text) == expected_result