Skip to content

Commit 3915cd3

Browse files
author
matteo_fiore
committed
test(test_cz_customize): adding tests for commit_parser, changelog_pattern, change_type_map
1 parent a16b26a commit 3915cd3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_cz_customize.py

+21
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
example = "feature: this feature enable customize through config file"
1111
schema = "<type>: <body>"
1212
schema_pattern = "(feature|bug fix):(\\s.*)"
13+
commit_parser = "^(?P<change_type>feature|bug fix):\\s(?P<message>.*)?"
14+
changelog_pattern = "^(feature|bug fix)?(!)?"
15+
change_type_map = {"feature" = "Feat", "bug fix" = "Fix"}
1316
1417
bump_pattern = "^(break|new|fix|hotfix)"
1518
bump_map = {"break" = "MAJOR", "new" = "MINOR", "fix" = "PATCH", "hotfix" = "PATCH"}
@@ -57,6 +60,9 @@
5760
"fix": "PATCH",
5861
"hotfix": "PATCH"
5962
},
63+
"commit_parser": "^(?P<change_type>feature|bug fix):\\s(?P<message>.*)?",
64+
"changelog_pattern": "^(feature|bug fix)?(!)?",
65+
"change_type_map": {"feature": "Feat", "bug fix": "Fix"},
6066
"change_type_order": ["perf", "BREAKING CHANGE", "feat", "fix", "refactor"],
6167
"info": "This is a customized cz.",
6268
"questions": [
@@ -363,3 +369,18 @@ def test_info_with_info_path(tmpdir, config_info):
363369
def test_info_without_info(config_without_info):
364370
cz = CustomizeCommitsCz(config_without_info)
365371
assert cz.info() is None
372+
373+
374+
def test_commit_parser(config):
375+
cz = CustomizeCommitsCz(config)
376+
assert cz.commit_parser == "^(?P<change_type>feature|bug fix):\\s(?P<message>.*)?"
377+
378+
379+
def test_changelog_pattern(config):
380+
cz = CustomizeCommitsCz(config)
381+
assert cz.changelog_pattern == "^(feature|bug fix)?(!)?"
382+
383+
384+
def test_change_type_map(config):
385+
cz = CustomizeCommitsCz(config)
386+
assert cz.change_type_map == {"feature": "Feat", "bug fix": "Fix"}

0 commit comments

Comments
 (0)