2024-05-21 16:43:36 +00:00
|
|
|
defmodule Jol.Blog.ParserTest do
|
|
|
|
use ExUnit.Case, async: true
|
|
|
|
alias Jol.Blog.Parser
|
|
|
|
|
2024-05-21 16:46:48 +00:00
|
|
|
setup do
|
2024-05-21 16:43:36 +00:00
|
|
|
content = """
|
|
|
|
+++
|
|
|
|
title = "test post"
|
|
|
|
draft = false
|
|
|
|
date = 2024-01-02 14:00:00-05:00
|
|
|
|
|
|
|
|
[taxonomies]
|
|
|
|
tags = ["howto", "hardware"]
|
|
|
|
+++
|
|
|
|
|
|
|
|
Body!
|
|
|
|
"""
|
|
|
|
|
2024-05-21 16:46:48 +00:00
|
|
|
{:ok, content: content}
|
|
|
|
end
|
|
|
|
|
|
|
|
test "parses attrs from zola-style posts", post do
|
|
|
|
{_attrs, body} = Parser.parse("/fake/filename", post.content)
|
2024-05-21 16:43:36 +00:00
|
|
|
assert body == "Body!"
|
|
|
|
end
|
|
|
|
end
|