@@ -152,6 +152,36 @@ def test_subprocess_fail__conventional_with_multiple_scopes(cmd, conventional_co
152152 assert result == RESULT_FAIL
153153
154154
155+ def test_main_success__custom_scopes_optional_scope (conventional_commit_path ):
156+ result = main (["--scopes" , "api,client" , conventional_commit_path ])
157+ assert result == RESULT_SUCCESS
158+
159+
160+ def test_main_success__custom_scopes_with_allowed_scope (conventional_commit_with_multiple_scopes_path ):
161+ result = main (["--scopes" , "chore,api,client" , conventional_commit_with_multiple_scopes_path ])
162+ assert result == RESULT_SUCCESS
163+
164+
165+ def test_main_fail__custom_scopes_with_disallowed_scope (conventional_commit_with_scope_path ):
166+ result = main (["--scopes" , "api,client" , conventional_commit_with_scope_path ])
167+ assert result == RESULT_FAIL
168+
169+
170+ def test_main_fail__custom_scopes_require_scope_no_scope (conventional_commit_path ):
171+ result = main (["--scopes" , "chore,feat,fix,custom" , "--force-scope" , conventional_commit_path ])
172+ assert result == RESULT_FAIL
173+
174+
175+ def test_main_success__custom_scopes_require_scope_with_allowed_scope (conventional_commit_with_scope_path ):
176+ result = main (["--scopes" , "api,client,scope" , "--force-scope" , conventional_commit_with_scope_path ])
177+ assert result == RESULT_SUCCESS
178+
179+
180+ def test_main_fail__custom_scopes_require_scope_with_disallowed_scope (conventional_commit_with_scope_path ):
181+ result = main (["--scopes" , "api,client" , "--force-scope" , conventional_commit_with_scope_path ])
182+ assert result == RESULT_FAIL
183+
184+
155185def test_subprocess_success__fixup_commit (cmd , fixup_commit_path ):
156186 result = subprocess .call ((cmd , fixup_commit_path ))
157187
0 commit comments