22 lines
724 B
Python
22 lines
724 B
Python
import pytest
|
|
from git_commit_ai.core.conventional import validate_conventional, fix_conventional
|
|
|
|
def test_validate_conventional_valid():
|
|
"""Test valid conventional commit."""
|
|
message = "feat(auth): add login functionality"
|
|
is_valid, _ = validate_conventional(message)
|
|
assert is_valid is True
|
|
|
|
def test_validate_conventional_invalid():
|
|
"""Test invalid conventional commit."""
|
|
message = "just a regular commit"
|
|
is_valid, _ = validate_conventional(message)
|
|
assert is_valid is False
|
|
|
|
def test_fix_conventional():
|
|
"""Test conventional commit fixing."""
|
|
message = "added new feature"
|
|
diff = ["main.py"]
|
|
fixed = fix_conventional(message, diff)
|
|
assert fixed.startswith("feat:")
|