@@ -26,16 +26,6 @@ var json2csvTests = function () {
2626 } ) ;
2727 } ) ;
2828
29- it ( 'should convert plain JSON to CSV and sort the header' , function ( done ) {
30- converter . json2csv ( jsonTestData . regularJson , function ( err , csv ) {
31- if ( err ) { throw err ; }
32- true . should . equal ( _ . isEqual ( err , null ) ) ;
33- csv . should . equal ( csvTestData . unQuoted . regularJsonSorted ) ;
34- csv . split ( options . EOL ) . length . should . equal ( 6 ) ;
35- done ( ) ;
36- } , { SORT_HEADER : true } ) ;
37- } ) ;
38-
3929 it ( 'should parse nested JSON to CSV - 1' , function ( done ) {
4030 converter . json2csv ( jsonTestData . nestedJson , function ( err , csv ) {
4131 if ( err ) { throw err ; }
@@ -86,16 +76,6 @@ var json2csvTests = function () {
8676 } ) ;
8777 } ) ;
8878
89- it ( 'should parse a single JSON document with Boolean to CSV' , function ( done ) {
90- converter . json2csv ( jsonTestData . singleDocWithBoolean , function ( err , csv ) {
91- if ( err ) { throw err ; }
92- true . should . equal ( _ . isEqual ( err , null ) ) ;
93- csv . should . equal ( csvTestData . unQuoted . singleDocWithBoolean ) ;
94- csv . split ( options . EOL ) . length . should . equal ( 3 ) ;
95- done ( ) ;
96- } ) ;
97- } ) ;
98-
9979 it ( 'should parse an array of JSON documents to CSV' , function ( done ) {
10080 converter . json2csv ( jsonTestData . arrayValue , function ( err , csv ) {
10181 if ( err ) { throw err ; }
@@ -106,16 +86,6 @@ var json2csvTests = function () {
10686 } ) ;
10787 } ) ;
10888
109- it ( 'should parse an array of JSON documents which includes arrays with objects to CSV' , function ( done ) {
110- converter . json2csv ( jsonTestData . arrayValueDocsWithObjects , function ( err , csv ) {
111- if ( err ) { throw err ; }
112- true . should . equal ( _ . isEqual ( err , null ) ) ;
113- csv . should . equal ( csvTestData . unQuoted . arrayValueDocsWithObjects ) ;
114- csv . split ( options . EOL ) . length . should . equal ( 5 ) ;
115- done ( ) ;
116- } ) ;
117- } ) ;
118-
11989 it ( 'should parse an array of JSON documents with the same schema but different ordering of fields' , function ( done ) {
12090 converter . json2csv ( jsonTestData . sameSchemaDifferentOrdering , function ( err , csv ) {
12191 if ( err ) { throw err ; }
@@ -126,19 +96,6 @@ var json2csvTests = function () {
12696 } ) ;
12797 } ) ;
12898
129- it ( 'should convert two documents with different schemas properly' , function ( done ) {
130- opts = JSON . parse ( JSON . stringify ( options ) ) ;
131- opts . CHECK_SCHEMA_DIFFERENCES = false ;
132-
133- converter . json2csv ( jsonTestData . differentSchemas , function ( err , csv ) {
134- if ( err ) { throw err ; }
135- true . should . equal ( _ . isEqual ( err , null ) ) ;
136- csv . should . equal ( csvTestData . unQuoted . differentSchemas ) ;
137- csv . split ( options . EOL ) . length . should . equal ( 6 ) ;
138- done ( ) ;
139- } , opts ) ;
140- } ) ;
141-
14299 it ( 'should throw an error if the documents do not have the same schema' , function ( done ) {
143100 converter . json2csv ( jsonTestData . differentSchemas , function ( err , csv ) {
144101 err . message . should . equal ( constants . Errors . json2csv . notSameSchema ) ;
@@ -323,19 +280,6 @@ var json2csvTests = function () {
323280 } , opts ) ;
324281 } ) ;
325282
326- it ( 'should convert two documents with different schemas properly' , function ( done ) {
327- opts = JSON . parse ( JSON . stringify ( options ) ) ;
328- opts . CHECK_SCHEMA_DIFFERENCES = false ;
329-
330- converter . json2csv ( jsonTestData . differentSchemas , function ( err , csv ) {
331- if ( err ) { throw err ; }
332- true . should . equal ( _ . isEqual ( err , null ) ) ;
333- csv . should . equal ( csvTestData . unQuoted . differentSchemas ) ;
334- csv . split ( options . EOL ) . length . should . equal ( 6 ) ;
335- done ( ) ;
336- } , opts ) ;
337- } ) ;
338-
339283 it ( 'should throw an error if the documents do not have the same schema' , function ( done ) {
340284 converter . json2csv ( jsonTestData . differentSchemas , function ( err , csv ) {
341285 err . message . should . equal ( constants . Errors . json2csv . notSameSchema ) ;
@@ -500,7 +444,7 @@ var json2csvTests = function () {
500444 } ) ;
501445
502446 it ( 'should repress the heading' , function ( done ) {
503- var opts = JSON . parse ( JSON . stringify ( options ) ) ;
447+ opts = JSON . parse ( JSON . stringify ( options ) ) ;
504448 opts . PREPEND_HEADER = false ;
505449
506450 converter . json2csv ( jsonTestData . sameSchemaDifferentOrdering , function ( err , csv ) {
@@ -512,20 +456,6 @@ var json2csvTests = function () {
512456 } , opts ) ;
513457 } ) ;
514458
515- it ( 'should convert two documents with different schemas properly' , function ( done ) {
516- var opts = JSON . parse ( JSON . stringify ( options ) ) ;
517- opts . PREPEND_HEADER = true ;
518- opts . CHECK_SCHEMA_DIFFERENCES = false ;
519-
520- converter . json2csv ( jsonTestData . differentSchemas , function ( err , csv ) {
521- if ( err ) { throw err ; }
522- true . should . equal ( _ . isEqual ( err , null ) ) ;
523- csv . should . equal ( csvTestData . unQuoted . differentSchemas . replace ( / , / g, options . DELIMITER . FIELD ) . split ( options . EOL ) . join ( options . EOL ) ) ;
524- csv . split ( options . EOL ) . length . should . equal ( 6 ) ;
525- done ( ) ;
526- } , opts ) ;
527- } ) ;
528-
529459 it ( 'should throw an error if the documents do not have the same schema' , function ( done ) {
530460 converter . json2csv ( jsonTestData . differentSchemas , function ( err , csv ) {
531461 err . message . should . equal ( constants . Errors . json2csv . notSameSchema ) ;
@@ -712,19 +642,6 @@ var json2csvTests = function () {
712642 } , opts ) ;
713643 } ) ;
714644
715- it ( 'should convert two documents with different schemas properly' , function ( done ) {
716- var opts = JSON . parse ( JSON . stringify ( options ) ) ;
717- opts . CHECK_SCHEMA_DIFFERENCES = false ;
718-
719- converter . json2csv ( jsonTestData . differentSchemas , function ( err , csv ) {
720- if ( err ) { throw err ; }
721- true . should . equal ( _ . isEqual ( err , null ) ) ;
722- csv . should . equal ( csvTestData . quoted . differentSchemas ) ;
723- csv . split ( options . EOL ) . length . should . equal ( 6 ) ;
724- done ( ) ;
725- } , opts ) ;
726- } ) ;
727-
728645 it ( 'should throw an error if the documents do not have the same schema' , function ( done ) {
729646 converter . json2csv ( jsonTestData . differentSchemas , function ( err , csv ) {
730647 err . message . should . equal ( constants . Errors . json2csv . notSameSchema ) ;
@@ -929,21 +846,6 @@ var json2csvTests = function () {
929846 } ) ;
930847 } ) ;
931848
932- it ( 'should convert two documents with different schemas properly' , function ( done ) {
933- var opts = JSON . parse ( JSON . stringify ( options ) ) ;
934- opts . CHECK_SCHEMA_DIFFERENCES = false ;
935-
936- converter . json2csvAsync ( jsonTestData . differentSchemas , opts )
937- . then ( function ( csv ) {
938- csv . should . equal ( csvTestData . unQuoted . differentSchemas ) ;
939- csv . split ( options . EOL ) . length . should . equal ( 6 ) ;
940- done ( ) ;
941- } )
942- . catch ( function ( err ) {
943- throw err ;
944- } ) ;
945- } ) ;
946-
947849 it ( 'should throw an error if the documents do not have the same schema' , function ( done ) {
948850 converter . json2csvAsync ( jsonTestData . differentSchemas )
949851 . then ( function ( csv ) {
@@ -1115,21 +1017,6 @@ var json2csvTests = function () {
11151017 } ) ;
11161018 } ) ;
11171019
1118- it ( 'should convert two documents with different schemas properly' , function ( done ) {
1119- var opts = JSON . parse ( JSON . stringify ( options ) ) ;
1120- opts . CHECK_SCHEMA_DIFFERENCES = false ;
1121-
1122- converter . json2csvAsync ( jsonTestData . differentSchemas , opts )
1123- . then ( function ( csv ) {
1124- csv . should . equal ( csvTestData . unQuoted . differentSchemas ) ;
1125- csv . split ( options . EOL ) . length . should . equal ( 6 ) ;
1126- done ( ) ;
1127- } )
1128- . catch ( function ( err ) {
1129- throw err ;
1130- } ) ;
1131- } ) ;
1132-
11331020 it ( 'should throw an error if the documents do not have the same schema' , function ( done ) {
11341021 converter . json2csvAsync ( jsonTestData . differentSchemas , options )
11351022 . then ( function ( csv ) {
@@ -1302,21 +1189,6 @@ var json2csvTests = function () {
13021189 } ) ;
13031190 } ) ;
13041191
1305- it ( 'should convert two documents with different schemas properly' , function ( done ) {
1306- var opts = JSON . parse ( JSON . stringify ( options ) ) ;
1307- opts . CHECK_SCHEMA_DIFFERENCES = false ;
1308-
1309- converter . json2csvAsync ( jsonTestData . differentSchemas , opts )
1310- . then ( function ( csv ) {
1311- csv . should . equal ( csvTestData . unQuoted . differentSchemas . replace ( / , / g, options . DELIMITER . FIELD ) . split ( options . EOL ) . join ( options . EOL ) ) ;
1312- csv . split ( options . EOL ) . length . should . equal ( 6 ) ;
1313- done ( ) ;
1314- } )
1315- . catch ( function ( err ) {
1316- throw err ;
1317- } ) ;
1318- } ) ;
1319-
13201192 it ( 'should throw an error if the documents do not have the same schema' , function ( done ) {
13211193 converter . json2csvAsync ( jsonTestData . differentSchemas , options )
13221194 . then ( function ( csv ) {
@@ -1501,21 +1373,6 @@ var json2csvTests = function () {
15011373 } ) ;
15021374 } ) ;
15031375
1504- it ( 'should convert two documents with different schemas properly' , function ( done ) {
1505- var opts = JSON . parse ( JSON . stringify ( options ) ) ;
1506- opts . CHECK_SCHEMA_DIFFERENCES = false ;
1507-
1508- converter . json2csvAsync ( jsonTestData . differentSchemas , opts )
1509- . then ( function ( csv ) {
1510- csv . should . equal ( csvTestData . quoted . differentSchemas ) ;
1511- csv . split ( options . EOL ) . length . should . equal ( 6 ) ;
1512- done ( ) ;
1513- } )
1514- . catch ( function ( err ) {
1515- throw err ;
1516- } ) ;
1517- } ) ;
1518-
15191376 it ( 'should throw an error if the documents do not have the same schema' , function ( done ) {
15201377 converter . json2csvAsync ( jsonTestData . differentSchemas , options )
15211378 . then ( function ( csv ) {
0 commit comments