File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -523,3 +523,34 @@ def test_commit_command_shows_description_when_use_help_option(
523
523
524
524
out , _ = capsys .readouterr ()
525
525
file_regression .check (out , extension = ".txt" )
526
+
527
+
528
+ @pytest .mark .usefixtures ("staging_is_clean" )
529
+ @pytest .mark .parametrize (
530
+ "out" , ["no changes added to commit" , "nothing added to commit" ]
531
+ )
532
+ def test_commit_when_nothing_added_to_commit (config , mocker : MockFixture , out ):
533
+ prompt_mock = mocker .patch ("questionary.prompt" )
534
+ prompt_mock .return_value = {
535
+ "prefix" : "feat" ,
536
+ "subject" : "user created" ,
537
+ "scope" : "" ,
538
+ "is_breaking_change" : False ,
539
+ "body" : "" ,
540
+ "footer" : "" ,
541
+ }
542
+
543
+ commit_mock = mocker .patch ("commitizen.git.commit" )
544
+ commit_mock .return_value = cmd .Command (
545
+ out = out ,
546
+ err = "" ,
547
+ stdout = out .encode (),
548
+ stderr = b"" ,
549
+ return_code = 0 ,
550
+ )
551
+ error_mock = mocker .patch ("commitizen.out.error" )
552
+
553
+ commands .Commit (config , {})()
554
+
555
+ commit_mock .assert_called_once ()
556
+ error_mock .assert_called_once_with (out )
You can’t perform that action at this time.
0 commit comments