32 lines
687 B
Elixir
32 lines
687 B
Elixir
defmodule JOL.Blog.ParserTest do
|
|
use ExUnit.Case, async: true
|
|
alias JOL.Blog.Parser
|
|
|
|
setup do
|
|
content = """
|
|
+++
|
|
title = "test post"
|
|
draft = false
|
|
date = 2024-01-02 14:00:00-05:00
|
|
|
|
[taxonomies]
|
|
tags = ["howto", "hardware"]
|
|
+++
|
|
|
|
Body!
|
|
"""
|
|
|
|
{:ok, content: content}
|
|
end
|
|
|
|
test "parses the body from zola-style posts", post do
|
|
{_attrs, body} = Parser.parse("/fake/filename", post.content)
|
|
assert body == "Body!"
|
|
end
|
|
|
|
test "parses the attrs from zola-style posts", post do
|
|
{attrs, _body} = Parser.parse("filepath", post.content)
|
|
assert attrs == %{title: "test post", draft: false, tags: ["howto", "hardware"]}
|
|
end
|
|
end
|