chiya/test/chiya_web/markdown_test.exs
2023-07-05 06:49:50 +02:00

31 lines
787 B
Elixir

defmodule ChiyaWeb.MarkdownTest do
use Chiya.DataCase
alias ChiyaWeb.Markdown
describe "render/1" do
test "renders simple markdown" do
html = Markdown.render("# Title")
assert html =~ "id=\"title\""
assert html =~ "Title"
assert html =~ "</h1>"
end
test "renders a link to a note" do
html = Markdown.render("[[foo]]")
assert html =~ "/note/foo"
end
test "renders a link to a note with custom title" do
html = Markdown.render("[[foo|MyFoo]]")
assert html =~ "/note/foo"
assert html =~ "MyFoo"
end
test "renders a link to a not existing note with custom class" do
html = Markdown.render("[[foo]]")
assert html =~ "/note/foo"
assert html =~ "class=\"invalid\""
end
end
end