@@ -866,3 +866,47 @@ def test_invalid_subject_is_skipped(mocker, capsys):
866866 out , _ = capsys .readouterr ()
867867
868868 assert out == ("## Unreleased\n \n ### Feat\n \n - a new world\n \n " )
869+
870+
871+ @pytest .mark .freeze_time ("2022-02-13" )
872+ def test_changelog_with_customized_change_type_order (
873+ mocker , config_path , changelog_path , file_regression
874+ ):
875+ mocker .patch ("commitizen.git.GitTag.date" , "2022-02-13" )
876+
877+ with open (config_path , "a" ) as f :
878+ f .write ('tag_format = "$version"\n ' )
879+ f .write (
880+ 'change_type_order = ["BREAKING CHANGE", "Perf", "Fix", "Feat", "Refactor"]\n '
881+ )
882+
883+ # create commit and tag
884+ create_file_and_commit ("feat: new file" )
885+ testargs = ["cz" , "bump" , "--yes" ]
886+ mocker .patch .object (sys , "argv" , testargs )
887+ cli .main ()
888+ wait_for_tag ()
889+ create_file_and_commit ("feat: after 0.2.0" )
890+ create_file_and_commit ("feat: another feature" )
891+ create_file_and_commit ("fix: fix bug" )
892+
893+ testargs = ["cz" , "bump" , "--yes" ]
894+ mocker .patch .object (sys , "argv" , testargs )
895+ cli .main ()
896+ wait_for_tag ()
897+
898+ create_file_and_commit ("feat: getting ready for this" )
899+ create_file_and_commit ("perf: perf improvement" )
900+
901+ testargs = ["cz" , "bump" , "--yes" ]
902+ mocker .patch .object (sys , "argv" , testargs )
903+ cli .main ()
904+ wait_for_tag ()
905+
906+ testargs = ["cz" , "changelog" , "0.3.0..0.4.0" ]
907+ mocker .patch .object (sys , "argv" , testargs )
908+ cli .main ()
909+ with open (changelog_path , "r" ) as f :
910+ out = f .read ()
911+
912+ file_regression .check (out , extension = ".md" )
0 commit comments