logo

auto_linker

AutoLinker-shim, based on https://git.pleroma.social/pleroma/auto_linker
commit: 70675c1e883ca45107c498deef453f92617fbffd
parent: 84cf8aa00622c37c8e2d2c132c33115101648c90
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed, 27 Feb 2019 06:55:36 +0100

Fix schemes in tests

Diffstat:

Mlib/auto_linker/parser.ex2+-
Mtest/auto_linker_test.exs16++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/auto_linker/parser.ex b/lib/auto_linker/parser.ex @@ -12,7 +12,7 @@ defmodule AutoLinker.Parser do ## Examples - iex> AutoLinker.Parser.parse("Check out http://google.com/") + iex> AutoLinker.Parser.parse("Check out http://google.com") ~s{Check out <a href="http://google.com" class="auto-linker" target="_blank" rel="noopener noreferrer">http://google.com</a>} """ diff --git a/test/auto_linker_test.exs b/test/auto_linker_test.exs @@ -4,7 +4,7 @@ defmodule AutoLinkerTest do test "default link" do assert AutoLinker.link("http://google.com") == - "<a href=\"http://google.com\" class=\"auto-linker\" target=\"_blank\" rel=\"noopener noreferrer\">google.com</a>" + "<a href=\"http://google.com\" class=\"auto-linker\" target=\"_blank\" rel=\"noopener noreferrer\">http://google.com</a>" end test "markdown" do @@ -19,10 +19,10 @@ defmodule AutoLinkerTest do test "all kinds of links" do text = - "hello google.com https://ddg.com 888 888-8888 mailto:user@email.com [google.com](http://google.com)" + "hello http://google.com https://ddg.com 888 888-8888 mailto:user@email.com [google.com](http://google.com)" expected = - "hello <a href=\"http://google.com\">http://google.com</a> <a href=\"https://ddg.com\">https://ddg.com</a> 888 888-8888 <a href=\"mailto:user@email.com\">mailto:user@email.com</a> <a href='http://google.com'>http://google.com</a>" + "hello <a href=\"http://google.com\">http://google.com</a> <a href=\"https://ddg.com\">https://ddg.com</a> 888 888-8888 <a href=\"mailto:user@email.com\">mailto:user@email.com</a> <a href='http://google.com'>google.com</a>" assert AutoLinker.link(text, markdown: true, @@ -34,9 +34,9 @@ defmodule AutoLinkerTest do end test "rel as function" do - text = "google.com" + text = "http://google.com" - expected = "<a href=\"http://google.com\" rel=\"com\">google.com</a>" + expected = "<a href=\"http://google.com\" rel=\"com\">http://google.com</a>" custom_rel = fn url -> url |> String.split(".") |> List.last() @@ -185,7 +185,7 @@ defmodule AutoLinkerTest do text = "#test http://google.com/#test #tag" expected = - "<a href=\"https://example.com/tag/test\">#test</a> <a href=\"http://google.com/#test\">google.com/#test</a> <a href=\"https://example.com/tag/tag\">#tag</a>" + "<a href=\"https://example.com/tag/test\">#test</a> <a href=\"http://google.com/#test\">http://google.com/#test</a> <a href=\"https://example.com/tag/tag\">#tag</a>" assert AutoLinker.link(text, scheme: true, @@ -295,10 +295,10 @@ defmodule AutoLinkerTest do end test "email" do - text = "user@example.com" + text = "mailto:user@example.com" expected = - "<a href=\"mailto:user@example.com\" class=\"auto-linker\">mailto:user@example.com</a>" + "<a href=\"mailto:user@example.com\" class=\"auto-linker\" target=\"_blank\" rel=\"noopener noreferrer\">mailto:user@example.com</a>" assert AutoLinker.link(text) == expected end