21 lines
787 B
Python
21 lines
787 B
Python
import pytest
|
|
from git_commit_ai.core.prompt_builder import build_prompt, DEFAULT_PROMPT, CONVENTIONAL_PROMPT
|
|
|
|
def test_build_prompt_default():
|
|
"""Test default prompt building."""
|
|
prompt = build_prompt("test diff")
|
|
assert "test diff" in prompt
|
|
assert "No previous commits" in prompt
|
|
|
|
def test_build_prompt_with_history():
|
|
"""Test prompt building with history."""
|
|
prompt = build_prompt("test diff", history=["feat: add x", "fix: resolve y"])
|
|
assert "feat: add x" in prompt
|
|
assert "fix: resolve y" in prompt
|
|
|
|
def test_build_prompt_conventional():
|
|
"""Test conventional prompt building."""
|
|
prompt = build_prompt("test diff", conventional=True)
|
|
assert "conventional" in prompt.lower()
|
|
assert "feat" in prompt.lower() or "fix" in prompt.lower()
|