Skip to content

Commit 0f06472

Browse files
committed
test: fix test
1 parent c9abdb0 commit 0f06472

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

git_analytics/analyzers/commit_type.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from collections import Counter, defaultdict
22
from dataclasses import dataclass
3-
from enum import Enum
43
from typing import Dict, List
54

65
from git_analytics.entities import AnalyticsCommit, AnalyticsResult

git_analytics/static/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ <h1 class="h4 mb-0">Git-Analytics</h1>
1818
</div>
1919
<div>
2020
<a href="https://git-analytics.com" target="_blank" class="btn btn-outline-light">
21-
<i class="bi bi-bar-chart-steps"></i> Site
21+
<i class="bi bi-link-45deg"></i> Site
2222
</a>
2323
<a href="https://github.com/n0rfas/git-analytics" target="_blank" class="btn btn-outline-light">
2424
<i class="bi bi-github"></i> GitHub

tests/test_analyzers/test_commit_type.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from datetime import date
21

32
import pytest
43

@@ -83,14 +82,17 @@ def test_commit_type_commit_type_by_week():
8382
analyzer.process(commit)
8483
result = analyzer.result()
8584

86-
assert len(result.commit_type_by_week) == 11
87-
assert result.timeseries["2025-W18"] == {"unknown": 1, "style": 1, "test": 1}
88-
assert result.timeseries["2025-W14"] == {"unknown": 2, "fix": 1}
89-
assert result.timeseries["2025-W05"] == {"chore": 1, "refactor": 1, "fix": 1}
90-
assert result.timeseries["2025-W04"] == {"unknown": 2}
91-
assert result.timeseries["2025-W22"] == {"unknown": 1}
92-
assert result.timeseries["2024-W36"] == {"unknown": 4, "fix": 1, "refactor": 1}
93-
assert result.timeseries["2024-W01"] == {"unknown": 4}
85+
assert result.commit_type_by_week["2024-W01"] == {"unknown": 4}
86+
assert result.commit_type_by_week["2024-W36"] == {"fix": 1, "refactor": 1, "unknown": 4}
87+
assert result.commit_type_by_week["2025-W01"] == {"unknown": 3}
88+
assert result.commit_type_by_week["2025-W05"] == {"chore": 1, "fix": 1, "refactor": 1}
89+
assert result.commit_type_by_week["2025-W14"] == {"fix": 1, "unknown": 2}
90+
assert result.commit_type_by_week["2025-W18"] == {"style": 1, "test": 1, "unknown": 1}
91+
assert result.commit_type_by_week["2025-W22"] == {"fix": 1}
92+
assert result.commit_type_by_week["2025-W23"] == {"chore": 1, "unknown": 4}
93+
assert result.commit_type_by_week["2025-W25"] == {"chore": 1, "fix": 1, "test": 1, "unknown": 3}
94+
assert result.commit_type_by_week["2025-W26"] == {"refactor": 2, "style": 1, "unknown": 2}
95+
assert result.commit_type_by_week["2025-W27"] == {"refactor": 1}
9496

9597

9698
def test_commit_type_total_counter():
@@ -101,8 +103,7 @@ def test_commit_type_total_counter():
101103
analyzer.process(commit)
102104
result = analyzer.result()
103105

104-
assert sum(result.total_counter.values()) == 40
105-
assert result.total_counter == {"unknown": 23, "refactor": 5, "fix": 5, "chore": 3, "style": 2, "test": 2}
106+
assert result.commit_type_counter == {"unknown": 23, "refactor": 5, "fix": 5, "chore": 3, "style": 2, "test": 2}
106107

107108

108109
def test_commit_type_author_total_counter():
@@ -113,5 +114,8 @@ def test_commit_type_author_total_counter():
113114
analyzer.process(commit)
114115
result = analyzer.result()
115116

116-
assert result.author_total_counter.keys() == {"Alice", "Bob", "Carol", "Dave", "Oscar"}
117-
assert sum(sum(v.values()) for v in result.author_total_counter.values()) == 40
117+
assert result.author_commit_type_counter["Alice"] == {"chore": 1, "fix": 1, "style": 2, "unknown": 7}
118+
assert result.author_commit_type_counter["Bob"] == {"refactor": 5, "unknown": 1}
119+
assert result.author_commit_type_counter["Carol"] == {"chore": 1, "unknown": 3}
120+
assert result.author_commit_type_counter["Dave"] == {"test": 2, "unknown": 9}
121+
assert result.author_commit_type_counter["Oscar"] == {"chore": 1, "fix": 4, "unknown": 3}

0 commit comments

Comments
 (0)