chiya/test/chiya_web/markdown_test.exs

32 lines
787 B
Elixir
Raw Normal View History

2023-07-04 22:46:00 +02:00
defmodule ChiyaWeb.MarkdownTest do
2023-07-05 06:49:50 +02:00
use Chiya.DataCase
2023-07-04 22:46:00 +02:00
2023-07-05 06:49:50 +02:00
alias ChiyaWeb.Markdown
2023-07-04 22:46:00 +02:00
2023-07-05 06:49:50 +02:00
describe "render/1" do
test "renders simple markdown" do
html = Markdown.render("# Title")
assert html =~ "id=\"title\""
assert html =~ "Title"
assert html =~ "</h1>"
end
2023-07-04 22:46:00 +02:00
2023-07-05 06:49:50 +02:00
test "renders a link to a note" do
html = Markdown.render("[[foo]]")
assert html =~ "/note/foo"
end
2023-07-04 22:46:00 +02:00
2023-07-05 06:49:50 +02:00
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