Refactor Parser tests so the work happens in setup.

This commit is contained in:
Jessica Canady 2024-05-23 16:46:03 -04:00
parent 0eadfcf6cc
commit 2f21511749
Signed by: phoenix
SSH key fingerprint: SHA256:aaLOzOrLi+0n4eDZNQKH97PehwRt6KSE5fYJc+ZRKCQ

View file

@ -16,12 +16,25 @@ defmodule JOL.Blog.ParserTest do
Body!
"""
{:ok, content: content}
{attrs, body} = Parser.parse("/filename/doesnt/matter", content)
{:ok, content: content, attrs: attrs, body: body}
end
test "parses the body from zola-style posts", post do
{_attrs, body} = Parser.parse("/fake/filename", post.content)
assert body == "Body!"
assert post.body == "Body!"
end
test "parses the title from zola-style posts", post do
assert post.attrs.title == "test post"
end
test "parses the tags from zola-style posts", post do
assert post.attrs.tags == ["howto", "hardware"]
end
test "parses the draft status from zola-style posts", post do
assert post.attrs.draft == false
end
test "parses the attrs from zola-style posts", post do