add test for markdown

This commit is contained in:
Inhji 2023-07-05 06:49:50 +02:00
parent e87fa125bb
commit 2ac2e1ec01

View file

@ -1,25 +1,31 @@
defmodule ChiyaWeb.MarkdownTest do
use Chiya.DataCase
use Chiya.DataCase
alias ChiyaWeb.Markdown
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
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" 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
end
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