diff --git a/.tests/test_git.py b/.tests/test_git.py new file mode 100644 index 0000000..e7a03f1 --- /dev/null +++ b/.tests/test_git.py @@ -0,0 +1,34 @@ +"""Tests for git parsing.""" + +import tempfile +from pathlib import Path +import pytest + +from termflow.parsers.git_parser import GitLogParser, Commit, WorkflowStats + + +class TestGitLogParser: + """Test git log parser.""" + + def test_is_git_repo_true(self, tmp_path): + """Test detection of git repository.""" + (tmp_path / ".git").mkdir() + parser = GitLogParser(tmp_path) + assert parser.is_git_repo() is True + + def test_is_git_repo_false(self, tmp_path): + """Test detection of non-git directory.""" + parser = GitLogParser(tmp_path) + assert parser.is_git_repo() is False + + def test_parse_log_empty(self, tmp_path): + """Test parsing empty git log.""" + parser = GitLogParser(tmp_path) + commits = parser.parse_log() + assert commits == [] + + def test_analyze_workflow(self): + """Test workflow analysis.""" + parser = GitLogParser(Path.cwd()) + stats = parser.analyze_workflow() + assert isinstance(stats, WorkflowStats)