24 lines
599 B
Python
24 lines
599 B
Python
from datetime import date
|
|
from zona.models import Metadata
|
|
from zona.builder import split_metadata
|
|
from pathlib import Path
|
|
|
|
|
|
def test_split_metadata(tmp_path: Path):
|
|
content = """---
|
|
title: Test Post
|
|
date: 2025-06-03
|
|
description: This is a test.
|
|
---
|
|
|
|
# Hello World
|
|
"""
|
|
test_file = tmp_path / "test.md"
|
|
test_file.write_text(content)
|
|
meta, content = split_metadata(test_file)
|
|
|
|
assert isinstance(meta, Metadata)
|
|
assert meta.title == "Test Post"
|
|
assert meta.description == "This is a test."
|
|
assert meta.date == date(2025, 6, 3)
|
|
assert content == "# Hello World"
|