Skip to content

Commit 3910f84

Browse files
zevisertLee-W
authored andcommitted
test: update tests for keyboard shortcuts
Only testing that cz_conventional_commits has keyboard shortcuts configured, and that the use_shortcuts config option is known. Actually mocking and asserting against what's written to stdout is a footgun commitizen-tools#406, commitizen-tools#380
1 parent cfec0f5 commit 3910f84

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

tests/test_conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"changelog_incremental": False,
4747
"changelog_start_rev": None,
4848
"update_changelog_on_bump": False,
49+
"use_shortcuts": False,
4950
}
5051

5152
_new_settings = {
@@ -59,6 +60,7 @@
5960
"changelog_incremental": False,
6061
"changelog_start_rev": None,
6162
"update_changelog_on_bump": False,
63+
"use_shortcuts": False,
6264
}
6365

6466
_read_settings = {

tests/test_cz_conventional_commits.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ def test_questions(config):
6262
assert isinstance(questions[0], dict)
6363

6464

65+
def test_choices_all_have_keyboard_shortcuts(config):
66+
conventional_commits = ConventionalCommitsCz(config)
67+
questions = conventional_commits.questions()
68+
69+
list_questions = (q for q in questions if q['type'] == "list")
70+
for select in list_questions:
71+
assert all('key' in choice for choice in select['choices'])
72+
73+
6574
def test_small_answer(config):
6675
conventional_commits = ConventionalCommitsCz(config)
6776
answers = {

0 commit comments

Comments
 (0)