+ assert expected_text == text
+ end
+
+ test "gives a replacement for single-character local nicknames" do
+ text = "@o hi"
+ o = insert(:user, %{nickname: "o"})
+
+ {text, mentions, []} = Formatter.linkify(text)
+
+ assert length(mentions) == 1
+
+ expected_text =
+ "<span class='h-card'><a data-user='#{o.id}' class='u-url mention' href='#{o.ap_id}'>@<span>o</span></a></span> hi"
+
+ assert expected_text == text
+ end
+
+ test "does not give a replacement for single-character local nicknames who don't exist" do
+ text = "@a hi"
+
+ expected_text = "@a hi"
+ assert {^expected_text, [] = _mentions, [] = _tags} = Formatter.linkify(text)