Add .onion domain tests

This commit is contained in:
Mark Felder 2020-11-19 19:49:21 +00:00
parent 5573fe6d97
commit 9925f4514e

View file

@ -406,6 +406,15 @@ defmodule LinkifyTest do
assert Linkify.link(text, mention: true, mention_prefix: "/users/") == expected
end
test ".onion domain" do
text = "Hey @admin@vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd.onion"
expected =
"Hey <a href=\"/users/admin@vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd.onion\">@admin@vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd.onion</a>"
assert Linkify.link(text, mention: true, mention_prefix: "/users/") == expected
end
end
describe "hashtag links" do
@ -713,7 +722,8 @@ defmodule LinkifyTest do
text = "I looked at theonion.com; it was no longer funny."
expected = "I looked at <a href=\"http://theonion.com\">theonion.com</a>; it was no longer funny."
expected =
"I looked at <a href=\"http://theonion.com\">theonion.com</a>; it was no longer funny."
assert Linkify.link(text) == expected
end
@ -732,5 +742,15 @@ defmodule LinkifyTest do
assert Linkify.link(text) == expected
end
test ".onion domain" do
text =
"The riseup.net hidden service is at vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd.onion"
expected =
"The <a href=\"http://riseup.net\">riseup.net</a> hidden service is at <a href=\"http://vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd.onion\">vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd.onion</a>"
assert Linkify.link(text) == expected
end
end
end