defmodule AutoLinker.BuilderTest do
use ExUnit.Case, async: true
doctest AutoLinker.Builder
import AutoLinker.Builder
describe "create_phone_link" do
test "finishes" do
assert create_phone_link([], "", []) == ""
end
test "handles one link" do
phrase = "my exten is x888. Call me."
expected =
~s'my exten is x888. Call me.'
assert create_phone_link([["x888", ""]], phrase, []) == expected
end
test "handles multiple links" do
phrase = "555.555.5555 or (555) 888-8888"
expected =
~s'555.555.5555 or ' <>
~s'(555) 888-8888'
assert create_phone_link([["555.555.5555", ""], ["(555) 888-8888"]], phrase, []) == expected
end
end
end