From 2ac2e1ec01c83143be7be62fdac178f9be9611a0 Mon Sep 17 00:00:00 2001 From: Inhji Date: Wed, 5 Jul 2023 06:49:50 +0200 Subject: [PATCH] add test for markdown --- test/chiya_web/markdown_test.exs | 46 ++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/test/chiya_web/markdown_test.exs b/test/chiya_web/markdown_test.exs index bcb49fb..1ff6c6c 100644 --- a/test/chiya_web/markdown_test.exs +++ b/test/chiya_web/markdown_test.exs @@ -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 =~ "" - end + describe "render/1" do + test "renders simple markdown" do + html = Markdown.render("# Title") + assert html =~ "id=\"title\"" + assert html =~ "Title" + assert html =~ "" + 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 \ No newline at end of file + 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