@@ -541,7 +541,8 @@ var csv2jsonTests = function () {
541541 converter . csv2json ( csvTestData . quoted . nestedSomeFieldsWrappedJson , function ( err , json ) {
542542 if ( err ) { throw err ; }
543543 true . should . equal ( _ . isEqual ( err , null ) ) ;
544- var isEqual = _ . isEqual ( json , jsonTestData . nestedJson ) ;
544+ // Stringify the JSON since these libraries don't say they are equal due to a null field
545+ var isEqual = _ . isEqual ( JSON . stringify ( json ) , JSON . stringify ( jsonTestData . nestedSomeFieldsWrappedJson ) ) ;
545546 true . should . equal ( isEqual ) ;
546547 done ( ) ;
547548 } , options ) ;
@@ -608,6 +609,23 @@ var csv2jsonTests = function () {
608609 } ) ;
609610 } ) ;
610611
612+ describe ( 'Custom Options - No Delimiters Specified' , function ( ) {
613+ beforeEach ( function ( ) {
614+ options = JSON . parse ( JSON . stringify ( defaultOptions ) ) ;
615+ } ) ;
616+
617+ it ( 'should still work when no delimiters specified' , function ( done ) {
618+ delete options . DELIMITER ;
619+ converter . csv2json ( csvTestData . unQuoted . regularJson , function ( err , json ) {
620+ if ( err ) { throw err ; }
621+ true . should . equal ( _ . isEqual ( err , null ) ) ;
622+ var isEqual = _ . isEqual ( json , jsonTestData . regularJson ) ;
623+ true . should . equal ( isEqual ) ;
624+ done ( ) ;
625+ } , options ) ;
626+ } ) ;
627+ } ) ;
628+
611629 describe ( 'Testing other errors' , function ( ) {
612630 beforeEach ( function ( ) {
613631 options = JSON . parse ( JSON . stringify ( defaultOptions ) ) ;
@@ -1148,8 +1166,8 @@ var csv2jsonTests = function () {
11481166 it ( 'should parse a CSV with some fields wrapped and others unwrapped' , function ( done ) {
11491167 converter . csv2jsonAsync ( csvTestData . quoted . nestedSomeFieldsWrappedJson , options )
11501168 . then ( function ( json ) {
1151- var isEqual = _ . isEqual ( json , jsonTestData . nestedJson ) ;
1152- true . should . equal ( isEqual ) ;
1169+ // Stringify the JSON since these libraries don't say they are equal due to a null field
1170+ var isEqual = _ . isEqual ( JSON . stringify ( json ) , JSON . stringify ( jsonTestData . nestedSomeFieldsWrappedJson ) ) ; true . should . equal ( isEqual ) ;
11531171 done ( ) ;
11541172 } )
11551173 . catch ( function ( err ) {
@@ -1192,6 +1210,25 @@ var csv2jsonTests = function () {
11921210 } ) ;
11931211 } ) ;
11941212
1213+ describe ( 'Custom Options - No Delimiters Specified' , function ( ) {
1214+ beforeEach ( function ( ) {
1215+ options = JSON . parse ( JSON . stringify ( defaultOptions ) ) ;
1216+ } ) ;
1217+
1218+ it ( 'should still work when no delimiters specified' , function ( done ) {
1219+ delete options . DELIMITER ;
1220+ converter . csv2jsonAsync ( csvTestData . unQuoted . regularJson , options )
1221+ . then ( function ( json ) {
1222+ var isEqual = _ . isEqual ( json , jsonTestData . regularJson ) ;
1223+ true . should . equal ( isEqual ) ;
1224+ done ( ) ;
1225+ } )
1226+ . catch ( function ( err ) {
1227+ throw err ;
1228+ } ) ;
1229+ } ) ;
1230+ } ) ;
1231+
11951232 describe ( 'Testing other errors' , function ( ) {
11961233 beforeEach ( function ( ) {
11971234 options = JSON . parse ( JSON . stringify ( defaultOptions ) ) ;
0 commit comments