@@ -1180,6 +1180,74 @@ describe('cli', function () {
11801180 } ) ;
11811181 } ) ;
11821182
1183+ it ( 'bumps version in OpenAPI `openapi.yaml` file with CRLF Line Endings' , async function ( ) {
1184+ const expected = fs . readFileSync (
1185+ './test/mocks/openapi-1.3.0-crlf.yaml' ,
1186+ 'utf-8' ,
1187+ ) ;
1188+ const filename = 'openapi.yaml' ;
1189+ mock ( {
1190+ bump : 'minor' ,
1191+ realTestFiles : [
1192+ {
1193+ filename,
1194+ path : './test/mocks/openapi-1.2.3-crlf.yaml' ,
1195+ } ,
1196+ ] ,
1197+ } ) ;
1198+ await exec ( {
1199+ packageFiles : [ { filename, type : 'openapi' } ] ,
1200+ bumpFiles : [ { filename, type : 'openapi' } ] ,
1201+ } ) ;
1202+
1203+ // filePath is the first arg passed to writeFileSync
1204+ const packageJsonWriteFileSynchCall = findWriteFileCallForPath ( {
1205+ writeFileSyncSpy,
1206+ filename,
1207+ } ) ;
1208+
1209+ if ( ! packageJsonWriteFileSynchCall ) {
1210+ throw new Error ( `writeFileSynch not invoked with path ${ filename } ` ) ;
1211+ }
1212+
1213+ const calledWithContentStr = packageJsonWriteFileSynchCall [ 1 ] ;
1214+ expect ( calledWithContentStr ) . toEqual ( expected ) ;
1215+ } ) ;
1216+
1217+ it ( 'bumps version in OpenAPI `openapi.yaml` file with LF Line Endings' , async function ( ) {
1218+ const expected = fs . readFileSync (
1219+ './test/mocks/openapi-1.3.0-lf.yaml' ,
1220+ 'utf-8' ,
1221+ ) ;
1222+ const filename = 'openapi.yaml' ;
1223+ mock ( {
1224+ bump : 'minor' ,
1225+ realTestFiles : [
1226+ {
1227+ filename,
1228+ path : './test/mocks/openapi-1.2.3-lf.yaml' ,
1229+ } ,
1230+ ] ,
1231+ } ) ;
1232+ await exec ( {
1233+ packageFiles : [ { filename, type : 'openapi' } ] ,
1234+ bumpFiles : [ { filename, type : 'openapi' } ] ,
1235+ } ) ;
1236+
1237+ // filePath is the first arg passed to writeFileSync
1238+ const packageJsonWriteFileSynchCall = findWriteFileCallForPath ( {
1239+ writeFileSyncSpy,
1240+ filename,
1241+ } ) ;
1242+
1243+ if ( ! packageJsonWriteFileSynchCall ) {
1244+ throw new Error ( `writeFileSynch not invoked with path ${ filename } ` ) ;
1245+ }
1246+
1247+ const calledWithContentStr = packageJsonWriteFileSynchCall [ 1 ] ;
1248+ expect ( calledWithContentStr ) . toEqual ( expected ) ;
1249+ } ) ;
1250+
11831251 it ( 'bumps version in Maven `pom.xml` file with CRLF Line Endings' , async function ( ) {
11841252 const expected = fs . readFileSync (
11851253 './test/mocks/pom-6.4.0-crlf.xml' ,
0 commit comments