@@ -1068,6 +1068,39 @@ describe('patch/create', function() {
10681068 ]
10691069 } ;
10701070
1071+ const patchArray = [
1072+ {
1073+ oldFileName : 'file1' ,
1074+ oldHeader : 'timestamp1' ,
1075+ newFileName : 'file1' ,
1076+ newHeader : 'timestamp2' ,
1077+ hunks : [
1078+ {
1079+ oldStart : 1 ,
1080+ oldLines : 1 ,
1081+ newStart : 1 ,
1082+ newLines : 1 ,
1083+ lines : [ '-a' , '+b' ]
1084+ }
1085+ ]
1086+ } ,
1087+ {
1088+ oldFileName : 'file2' ,
1089+ oldHeader : 'timestamp3' ,
1090+ newFileName : 'file2' ,
1091+ newHeader : 'timestamp4' ,
1092+ hunks : [
1093+ {
1094+ oldStart : 1 ,
1095+ oldLines : 1 ,
1096+ newStart : 1 ,
1097+ newLines : 1 ,
1098+ lines : [ '-x' , '+y' ]
1099+ }
1100+ ]
1101+ }
1102+ ] ;
1103+
10711104 it ( 'should include all headers with INCLUDE_HEADERS' , function ( ) {
10721105 const result = formatPatch ( patch , INCLUDE_HEADERS ) ;
10731106 const expected =
@@ -1132,39 +1165,7 @@ describe('patch/create', function() {
11321165 } ) ;
11331166
11341167 it ( 'should work with array of patches and INCLUDE_HEADERS' , function ( ) {
1135- const patches = [
1136- {
1137- oldFileName : 'file1' ,
1138- oldHeader : 'timestamp1' ,
1139- newFileName : 'file1' ,
1140- newHeader : 'timestamp2' ,
1141- hunks : [
1142- {
1143- oldStart : 1 ,
1144- oldLines : 1 ,
1145- newStart : 1 ,
1146- newLines : 1 ,
1147- lines : [ '-a' , '+b' ]
1148- }
1149- ]
1150- } ,
1151- {
1152- oldFileName : 'file2' ,
1153- oldHeader : 'timestamp3' ,
1154- newFileName : 'file2' ,
1155- newHeader : 'timestamp4' ,
1156- hunks : [
1157- {
1158- oldStart : 1 ,
1159- oldLines : 1 ,
1160- newStart : 1 ,
1161- newLines : 1 ,
1162- lines : [ '-x' , '+y' ]
1163- }
1164- ]
1165- }
1166- ] ;
1167- const result = formatPatch ( patches , INCLUDE_HEADERS ) ;
1168+ const result = formatPatch ( patchArray , INCLUDE_HEADERS ) ;
11681169 const expected =
11691170 'Index: file1\n' +
11701171 '===================================================================\n' +
@@ -1185,39 +1186,7 @@ describe('patch/create', function() {
11851186 } ) ;
11861187
11871188 it ( 'should work with array of patches and FILE_HEADERS_ONLY' , function ( ) {
1188- const patches = [
1189- {
1190- oldFileName : 'file1' ,
1191- oldHeader : 'timestamp1' ,
1192- newFileName : 'file1' ,
1193- newHeader : 'timestamp2' ,
1194- hunks : [
1195- {
1196- oldStart : 1 ,
1197- oldLines : 1 ,
1198- newStart : 1 ,
1199- newLines : 1 ,
1200- lines : [ '-a' , '+b' ]
1201- }
1202- ]
1203- } ,
1204- {
1205- oldFileName : 'file2' ,
1206- oldHeader : 'timestamp3' ,
1207- newFileName : 'file2' ,
1208- newHeader : 'timestamp4' ,
1209- hunks : [
1210- {
1211- oldStart : 1 ,
1212- oldLines : 1 ,
1213- newStart : 1 ,
1214- newLines : 1 ,
1215- lines : [ '-x' , '+y' ]
1216- }
1217- ]
1218- }
1219- ] ;
1220- const result = formatPatch ( patches , FILE_HEADERS_ONLY ) ;
1189+ const result = formatPatch ( patchArray , FILE_HEADERS_ONLY ) ;
12211190 const expected =
12221191 '--- file1\ttimestamp1\n' +
12231192 '+++ file1\ttimestamp2\n' +
@@ -1234,39 +1203,7 @@ describe('patch/create', function() {
12341203 } ) ;
12351204
12361205 it ( 'should work with array of patches and OMIT_HEADERS' , function ( ) {
1237- const patches = [
1238- {
1239- oldFileName : 'file1' ,
1240- oldHeader : 'timestamp1' ,
1241- newFileName : 'file1' ,
1242- newHeader : 'timestamp2' ,
1243- hunks : [
1244- {
1245- oldStart : 1 ,
1246- oldLines : 1 ,
1247- newStart : 1 ,
1248- newLines : 1 ,
1249- lines : [ '-a' , '+b' ]
1250- }
1251- ]
1252- } ,
1253- {
1254- oldFileName : 'file2' ,
1255- oldHeader : 'timestamp3' ,
1256- newFileName : 'file2' ,
1257- newHeader : 'timestamp4' ,
1258- hunks : [
1259- {
1260- oldStart : 1 ,
1261- oldLines : 1 ,
1262- newStart : 1 ,
1263- newLines : 1 ,
1264- lines : [ '-x' , '+y' ]
1265- }
1266- ]
1267- }
1268- ] ;
1269- const result = formatPatch ( patches , OMIT_HEADERS ) ;
1206+ const result = formatPatch ( patchArray , OMIT_HEADERS ) ;
12701207 const expected =
12711208 '@@ -1,1 +1,1 @@\n' +
12721209 '-a\n' +
0 commit comments