@@ -10,28 +10,31 @@ import (
1010
1111func TestCommitRewordCommit (t * testing.T ) {
1212 type scenario struct {
13- testName string
14- runner * oscommands.FakeCmdObjRunner
15- input string
13+ testName string
14+ runner * oscommands.FakeCmdObjRunner
15+ summary string
16+ description string
1617 }
1718 scenarios := []scenario {
1819 {
1920 "Single line reword" ,
2021 oscommands .NewFakeRunner (t ).ExpectGitArgs ([]string {"commit" , "--allow-empty" , "--amend" , "--only" , "-m" , "test" }, "" , nil ),
2122 "test" ,
23+ "" ,
2224 },
2325 {
2426 "Multi line reword" ,
2527 oscommands .NewFakeRunner (t ).ExpectGitArgs ([]string {"commit" , "--allow-empty" , "--amend" , "--only" , "-m" , "test" , "-m" , "line 2\n line 3" }, "" , nil ),
26- "test\n line 2\n line 3" ,
28+ "test" ,
29+ "line 2\n line 3" ,
2730 },
2831 }
2932 for _ , s := range scenarios {
3033 s := s
3134 t .Run (s .testName , func (t * testing.T ) {
3235 instance := buildCommitCommands (commonDeps {runner : s .runner })
3336
34- assert .NoError (t , instance .RewordLastCommit (s .input ))
37+ assert .NoError (t , instance .RewordLastCommit (s .summary , s . description ))
3538 s .runner .CheckForMissingCalls ()
3639 })
3740 }
@@ -50,7 +53,8 @@ func TestCommitResetToCommit(t *testing.T) {
5053func TestCommitCommitCmdObj (t * testing.T ) {
5154 type scenario struct {
5255 testName string
53- message string
56+ summary string
57+ description string
5458 configSignoff bool
5559 configSkipHookPrefix string
5660 expectedArgs []string
@@ -59,35 +63,36 @@ func TestCommitCommitCmdObj(t *testing.T) {
5963 scenarios := []scenario {
6064 {
6165 testName : "Commit" ,
62- message : "test" ,
66+ summary : "test" ,
6367 configSignoff : false ,
6468 configSkipHookPrefix : "" ,
6569 expectedArgs : []string {"commit" , "-m" , "test" },
6670 },
6771 {
6872 testName : "Commit with --no-verify flag" ,
69- message : "WIP: test" ,
73+ summary : "WIP: test" ,
7074 configSignoff : false ,
7175 configSkipHookPrefix : "WIP" ,
7276 expectedArgs : []string {"commit" , "--no-verify" , "-m" , "WIP: test" },
7377 },
7478 {
7579 testName : "Commit with multiline message" ,
76- message : "line1\n line2" ,
80+ summary : "line1" ,
81+ description : "line2" ,
7782 configSignoff : false ,
7883 configSkipHookPrefix : "" ,
7984 expectedArgs : []string {"commit" , "-m" , "line1" , "-m" , "line2" },
8085 },
8186 {
8287 testName : "Commit with signoff" ,
83- message : "test" ,
88+ summary : "test" ,
8489 configSignoff : true ,
8590 configSkipHookPrefix : "" ,
8691 expectedArgs : []string {"commit" , "--signoff" , "-m" , "test" },
8792 },
8893 {
8994 testName : "Commit with signoff and no-verify" ,
90- message : "WIP: test" ,
95+ summary : "WIP: test" ,
9196 configSignoff : true ,
9297 configSkipHookPrefix : "WIP" ,
9398 expectedArgs : []string {"commit" , "--no-verify" , "--signoff" , "-m" , "WIP: test" },
@@ -104,7 +109,7 @@ func TestCommitCommitCmdObj(t *testing.T) {
104109 runner := oscommands .NewFakeRunner (t ).ExpectGitArgs (s .expectedArgs , "" , nil )
105110 instance := buildCommitCommands (commonDeps {userConfig : userConfig , runner : runner })
106111
107- assert .NoError (t , instance .CommitCmdObj (s .message ).Run ())
112+ assert .NoError (t , instance .CommitCmdObj (s .summary , s . description ).Run ())
108113 runner .CheckForMissingCalls ()
109114 })
110115 }
0 commit comments