Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.

Commit 1fd9728

Browse files
committed
ts: test sync api
1 parent 77b978c commit 1fd9728

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

test/api.types.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11

22
import 'should'
33
import * as parse from '../lib/index'
4+
import * as parse_sync from '../lib/sync'
45
import {CastingContext, Info, Options, Parser} from '../lib/index'
56

67
describe('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

Comments
 (0)