File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -116,4 +116,36 @@ describe('getDiff', () => {
116
116
expect ( result . steps [ 0 ] . error ) . to . be . true ;
117
117
expect ( result . steps [ 0 ] . errorMessage ) . to . contain ( 'No commit data found' ) ;
118
118
} ) ;
119
+
120
+ it ( 'should handle empty commit hash in commitFrom' , async ( ) => {
121
+ await fs . writeFile ( path . join ( tempDir , 'test.txt' ) , 'new content for parent test' ) ;
122
+ await git . add ( '.' ) ;
123
+ await git . commit ( 'commit for parent test' ) ;
124
+
125
+ const log = await git . log ( ) ;
126
+ const parentCommit = log . all [ 1 ] . hash ;
127
+ const headCommit = log . all [ 0 ] . hash ;
128
+
129
+ const action = new Action (
130
+ '1234567890' ,
131
+ 'push' ,
132
+ 'POST' ,
133
+ 1234567890 ,
134
+ 'test/repo'
135
+ ) ;
136
+
137
+ action . proxyGitPath = path . dirname ( tempDir ) ;
138
+ action . repoName = path . basename ( tempDir ) ;
139
+ action . commitFrom = '0000000000000000000000000000000000000000' ;
140
+ action . commitTo = headCommit ;
141
+ action . commitData = [
142
+ { parent : parentCommit }
143
+ ] ;
144
+
145
+ const result = await exec ( { } , action ) ;
146
+
147
+ expect ( result . steps [ 0 ] . error ) . to . be . false ;
148
+ expect ( result . steps [ 0 ] . content ) . to . not . be . null ;
149
+ expect ( result . steps [ 0 ] . content . length ) . to . be . greaterThan ( 0 ) ;
150
+ } ) ;
119
151
} ) ;
You can’t perform that action at this time.
0 commit comments