11
22import 'should'
33import * as parse from '../lib/index'
4+ import * as parse_sync from '../lib/sync'
45import { CastingContext , Info , Options , Parser } from '../lib/index'
56
67describe ( 'API Types' , ( ) => {
78
89 describe ( 'Parser' , ( ) => {
910
10- it ( 'Respect parse signature' , ( ) => {
11+ it ( 'default API, respect parse signature' , ( ) => {
1112 // No argument
1213 parse ( )
1314 parse ( "" )
@@ -22,11 +23,19 @@ describe('API Types', () => {
2223 parse ( { } )
2324 parse ( { } , ( ) => { } )
2425 } )
26+
27+ it ( 'sync API, respect parse signature' , ( ) => {
28+ // No argument
29+ parse_sync ( "" )
30+ parse_sync ( "" , { } )
31+ parse_sync ( Buffer . from ( "" ) )
32+ parse_sync ( Buffer . from ( "" ) , { } )
33+ } )
2534
2635 it ( 'Expose options' , ( ) => {
2736 const parser : Parser = parse ( )
2837 const options : Options = parser . options
29- const keys : any = Object . keys ( options )
38+ const keys : string [ ] = Object . keys ( options )
3039 keys . sort ( ) . should . eql ( [
3140 'bom' , 'cast' , 'cast_date' , 'columns' , 'comment' , 'delimiter' ,
3241 'escape' , 'from' , 'from_line' , 'info' , 'ltrim' , 'max_record_size' ,
@@ -41,7 +50,7 @@ describe('API Types', () => {
4150 it ( 'Expose info' , ( ) => {
4251 const parser : Parser = parse ( )
4352 const info : Info = parser . info
44- const keys : any = Object . keys ( info )
53+ const keys : string [ ] = Object . keys ( info )
4554 keys . sort ( ) . should . eql ( [
4655 'comment_lines' , 'empty_lines' ,
4756 'invalid_field_length' , 'lines' , 'records'
0 commit comments