Skip to content

Commit f720d2b

Browse files
committed
test(git): extend test for is_staging_clean
1 parent e92e07f commit f720d2b

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

commitizen/git.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def find_git_project_root() -> Optional[Path]:
154154

155155

156156
def is_staging_clean() -> bool:
157-
"""Check if staing is clean."""
157+
"""Check if staging is clean."""
158158
c = cmd.run("git diff --no-ext-diff --cached --name-only")
159159
return not bool(c.out)
160160

tests/test_git.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def test_get_commits_author_and_email():
7070
create_file_and_commit("fix: username exception")
7171
commit = git.get_commits()[0]
7272

73-
assert commit.author is not ""
73+
assert commit.author != ""
7474
assert "@" in commit.author_email
7575

7676

@@ -181,7 +181,18 @@ def test_is_staging_clean(tmp_commitizen_project):
181181
assert git.is_staging_clean() is True
182182

183183
cmd.run("touch test_file")
184+
185+
assert git.is_staging_clean() is True
186+
184187
cmd.run("git add test_file")
188+
189+
assert git.is_staging_clean() is False
190+
191+
cmd.run("git commit -m 'add test_file'")
185192
cmd.run("echo 'test' > test_file")
186193

194+
assert git.is_staging_clean() is True
195+
196+
cmd.run("git add test_file")
197+
187198
assert git.is_staging_clean() is False

0 commit comments

Comments
 (0)