Skip to content

Commit 4980e83

Browse files
committed
✨ feat: update commit message format in tests
✨ feat: update commit message format in tests 🔧 Tests: - Refactored test_format_commit_message to include categorized features and fixes. - Updated test_print_token_usage to validate both human-readable and precise cost formats. Enhanced test cases for commit message formatting and cost representation.
1 parent eea00ff commit 4980e83

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

tests/test_ai_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ def test_format_commit_message(ai_service):
155155
commit_data = CommitSuggestion(
156156
title="✨ feat: new feature",
157157
body={
158-
"Features": {"emoji": "✨", "changes": ["Change 1", "Change 2"]},
159-
"Fixes": {"emoji": "🐛", "changes": ["Fix 1"]},
158+
"Features": {"emoji": "✨", "changes": ["Change 1", "Change 2"]},
159+
"🐛 Fixes": {"emoji": "🐛", "changes": ["Fix 1"]},
160160
},
161161
summary="Added new features and fixed bugs",
162162
)

tests/test_console.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,13 @@ def test_print_token_usage(mock_console):
9999
assert "Completion Tokens: 50" in call_args
100100
assert "Total Tokens: 150" in call_args
101101
assert "Cost Breakdown" in call_args
102-
assert "Input Cost: €0.01000000" in call_args
103-
assert "Output Cost: €0.02000000" in call_args
104-
assert "Total Cost: €0.03000000" in call_args
102+
# Check both human-readable and precise formats
103+
assert "1.00¢ (cents)" in call_args # Input cost
104+
assert "(€0.01000000)" in call_args # Input cost precise
105+
assert "2.00¢ (cents)" in call_args # Output cost
106+
assert "(€0.02000000)" in call_args # Output cost precise
107+
assert "3.00¢ (cents)" in call_args # Total cost
108+
assert "(€0.03000000)" in call_args # Total cost precise
105109

106110

107111
def test_print_commit_message(mock_console):

0 commit comments

Comments
 (0)