@@ -26,16 +26,6 @@ var json2csvTests = function () {
26
26
} ) ;
27
27
} ) ;
28
28
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
-
39
29
it ( 'should parse nested JSON to CSV - 1' , function ( done ) {
40
30
converter . json2csv ( jsonTestData . nestedJson , function ( err , csv ) {
41
31
if ( err ) { throw err ; }
@@ -86,16 +76,6 @@ var json2csvTests = function () {
86
76
} ) ;
87
77
} ) ;
88
78
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
-
99
79
it ( 'should parse an array of JSON documents to CSV' , function ( done ) {
100
80
converter . json2csv ( jsonTestData . arrayValue , function ( err , csv ) {
101
81
if ( err ) { throw err ; }
@@ -106,16 +86,6 @@ var json2csvTests = function () {
106
86
} ) ;
107
87
} ) ;
108
88
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
-
119
89
it ( 'should parse an array of JSON documents with the same schema but different ordering of fields' , function ( done ) {
120
90
converter . json2csv ( jsonTestData . sameSchemaDifferentOrdering , function ( err , csv ) {
121
91
if ( err ) { throw err ; }
@@ -126,19 +96,6 @@ var json2csvTests = function () {
126
96
} ) ;
127
97
} ) ;
128
98
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
-
142
99
it ( 'should throw an error if the documents do not have the same schema' , function ( done ) {
143
100
converter . json2csv ( jsonTestData . differentSchemas , function ( err , csv ) {
144
101
err . message . should . equal ( constants . Errors . json2csv . notSameSchema ) ;
@@ -323,19 +280,6 @@ var json2csvTests = function () {
323
280
} , opts ) ;
324
281
} ) ;
325
282
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
-
339
283
it ( 'should throw an error if the documents do not have the same schema' , function ( done ) {
340
284
converter . json2csv ( jsonTestData . differentSchemas , function ( err , csv ) {
341
285
err . message . should . equal ( constants . Errors . json2csv . notSameSchema ) ;
@@ -500,7 +444,7 @@ var json2csvTests = function () {
500
444
} ) ;
501
445
502
446
it ( 'should repress the heading' , function ( done ) {
503
- var opts = JSON . parse ( JSON . stringify ( options ) ) ;
447
+ opts = JSON . parse ( JSON . stringify ( options ) ) ;
504
448
opts . PREPEND_HEADER = false ;
505
449
506
450
converter . json2csv ( jsonTestData . sameSchemaDifferentOrdering , function ( err , csv ) {
@@ -512,20 +456,6 @@ var json2csvTests = function () {
512
456
} , opts ) ;
513
457
} ) ;
514
458
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
-
529
459
it ( 'should throw an error if the documents do not have the same schema' , function ( done ) {
530
460
converter . json2csv ( jsonTestData . differentSchemas , function ( err , csv ) {
531
461
err . message . should . equal ( constants . Errors . json2csv . notSameSchema ) ;
@@ -712,19 +642,6 @@ var json2csvTests = function () {
712
642
} , opts ) ;
713
643
} ) ;
714
644
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
-
728
645
it ( 'should throw an error if the documents do not have the same schema' , function ( done ) {
729
646
converter . json2csv ( jsonTestData . differentSchemas , function ( err , csv ) {
730
647
err . message . should . equal ( constants . Errors . json2csv . notSameSchema ) ;
@@ -929,21 +846,6 @@ var json2csvTests = function () {
929
846
} ) ;
930
847
} ) ;
931
848
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
-
947
849
it ( 'should throw an error if the documents do not have the same schema' , function ( done ) {
948
850
converter . json2csvAsync ( jsonTestData . differentSchemas )
949
851
. then ( function ( csv ) {
@@ -1115,21 +1017,6 @@ var json2csvTests = function () {
1115
1017
} ) ;
1116
1018
} ) ;
1117
1019
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
-
1133
1020
it ( 'should throw an error if the documents do not have the same schema' , function ( done ) {
1134
1021
converter . json2csvAsync ( jsonTestData . differentSchemas , options )
1135
1022
. then ( function ( csv ) {
@@ -1302,21 +1189,6 @@ var json2csvTests = function () {
1302
1189
} ) ;
1303
1190
} ) ;
1304
1191
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
-
1320
1192
it ( 'should throw an error if the documents do not have the same schema' , function ( done ) {
1321
1193
converter . json2csvAsync ( jsonTestData . differentSchemas , options )
1322
1194
. then ( function ( csv ) {
@@ -1501,21 +1373,6 @@ var json2csvTests = function () {
1501
1373
} ) ;
1502
1374
} ) ;
1503
1375
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
-
1519
1376
it ( 'should throw an error if the documents do not have the same schema' , function ( done ) {
1520
1377
converter . json2csvAsync ( jsonTestData . differentSchemas , options )
1521
1378
. then ( function ( csv ) {
0 commit comments