Skip to content

Commit f01a03c

Browse files
committed
test(git): add test case to get_latest_tag_name
1 parent d6a817c commit f01a03c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/test_git.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55

6-
from commitizen import git
6+
from commitizen import cmd, git
77
from tests.utils import FakeCommand, create_file_and_commit
88

99

@@ -104,3 +104,14 @@ def test_get_tag_names_has_correct_arrow_annotation():
104104
arrow_annotation = inspect.getfullargspec(git.get_tag_names).annotations["return"]
105105

106106
assert arrow_annotation == List[Optional[str]]
107+
108+
109+
def test_get_latest_tag_name(tmp_commitizen_project):
110+
with tmp_commitizen_project.as_cwd():
111+
tag_name = git.get_latest_tag_name()
112+
assert tag_name is None
113+
114+
create_file_and_commit("feat(test): test")
115+
cmd.run("git tag 1.0")
116+
tag_name = git.get_latest_tag_name()
117+
assert tag_name == "1.0"

0 commit comments

Comments
 (0)