commit: 9925f4514ef8a2421f76c86ba465d9163e7b67ca
parent 5573fe6d979735219d03d71beb5a26dddad69a5e
Author: Mark Felder <feld@FreeBSD.org>
Date: Thu, 19 Nov 2020 19:49:21 +0000
Add .onion domain tests
Diffstat:
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/test/linkify_test.exs b/test/linkify_test.exs
@@ -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