@@ -46,8 +46,8 @@ describe("testCSVConverter3", function () {
4646 . subscribe ( function ( json ) {
4747 assert . equal ( typeof json . column1 , "string" ) ;
4848 assert . equal ( json . column5 , "hello world" ) ;
49- assert . strictEqual ( json [ "name#!" ] , false ) ;
50- assert . strictEqual ( json [ "column9" ] , true ) ;
49+ assert . strictEqual ( json [ "name#!" ] , false ) ;
50+ assert . strictEqual ( json [ "column9" ] , true ) ;
5151 } )
5252 . on ( 'done' , function ( ) {
5353 done ( )
@@ -194,26 +194,38 @@ describe("testCSVConverter3", function () {
194194 "1","2","3"
195195 "fefe,5",6` )
196196 . then ( ( d ) => {
197- assert . equal ( d [ 0 ] . a , '"1"' ) ;
198- assert . equal ( d [ 0 ] . b , '"2"' ) ;
199- assert . equal ( d [ 1 ] . a , '"fefe' ) ;
200- assert . equal ( d [ 1 ] . b , '5"' ) ;
197+ assert . equal ( d [ 0 ] . a , '"1"' ) ;
198+ assert . equal ( d [ 0 ] . b , '"2"' ) ;
199+ assert . equal ( d [ 1 ] . a , '"fefe' ) ;
200+ assert . equal ( d [ 1 ] . b , '5"' ) ;
201201 } )
202202 } )
203- it ( "should allow ignoreEmpty with checkColumn" , ( ) => {
203+ it ( "should allow ignoreEmpty with checkColumn" , ( ) => {
204204 return csv ( {
205- checkColumn :true ,
205+ checkColumn : true ,
206206 ignoreEmpty : true
207207 } )
208- . fromString ( `date,altitude,airtime
208+ . fromString ( `date,altitude,airtime
209209 2016-07-08,2000,23
210210
211211 2016-07-09,3000,43` )
212- . then ( ( data ) => {
212+ . then ( ( data ) => {
213213
214- } , ( err ) => {
215- console . log ( err ) ;
216- assert ( ! err ) ;
214+ } , ( err ) => {
215+ console . log ( err ) ;
216+ assert ( ! err ) ;
217+ } )
218+ } ) ;
219+ it ( "should allow quotes without content" , ( ) => {
220+ const data = "a|^^|^b^" ;
221+ return csv ( {
222+ delimiter : '|' ,
223+ quote : '^' ,
224+ noheader : true ,
217225 } )
226+ . fromString ( data )
227+ . then ( ( jsonObj ) => {
228+ assert . equal ( jsonObj [ 0 ] . field2 , "" ) ;
229+ } ) ;
218230 } )
219231} ) ;
0 commit comments