Files
rdb-discovery/tests/test_tasks.py
T

60 lines
1.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from pathlib import Path
from rdb_discovery.tasks import get_next_task, update_task_status
def test_get_next_task(tmp_path: Path) -> None:
(tmp_path / "TASKS.md").write_text(
"# TASKS.md\n\n"
"## TASK-001 - First\nStatus: Done\n\n"
"## TASK-002 - Second\nStatus: Todo\n\n",
encoding="utf-8",
)
task = get_next_task(tmp_path)
assert task is not None
assert task.task_id == "TASK-002"
assert task.title == "Second"
def test_get_next_task_with_em_dash(tmp_path: Path) -> None:
(tmp_path / "TASKS.md").write_text(
"# TASKS.md\n\n"
"## TASK-001 — First\nStatus: Done\n\n"
"## TASK-002 — Second\nStatus: Todo\n\n",
encoding="utf-8",
)
task = get_next_task(tmp_path)
assert task is not None
assert task.task_id == "TASK-002"
assert task.title == "Second"
def test_get_next_task_with_en_dash(tmp_path: Path) -> None:
(tmp_path / "TASKS.md").write_text(
"# TASKS.md\n\n"
"## TASK-001 First\nStatus: Done\n\n"
"## TASK-002 Second\nStatus: Todo\n\n",
encoding="utf-8",
)
task = get_next_task(tmp_path)
assert task is not None
assert task.task_id == "TASK-002"
assert task.title == "Second"
def test_update_task_status(tmp_path: Path) -> None:
tasks = tmp_path / "TASKS.md"
tasks.write_text(
"# TASKS.md\n\n## TASK-001 - First\nStatus: Todo\n\n",
encoding="utf-8",
)
assert update_task_status(tmp_path, "TASK-001", "In Progress") is True
assert "Status: In Progress" in tasks.read_text(encoding="utf-8")