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

Commit f03c5f6

Browse files
committed
test: duplicate column names
1 parent d0e3471 commit f03c5f6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/option.columns.coffee

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,32 @@ describe 'Option `columns`', ->
5151
columns.should.eql ["a", false, "c", false] unless err
5252
next err
5353

54+
describe 'duplicate column names', ->
55+
56+
it 'with true', (next) ->
57+
parse '''
58+
a,b,a,c
59+
1,2,3,4
60+
5,6,7,8
61+
''', columns: true, (err, data) ->
62+
data.should.eql [
63+
{a: '3', b: '2', c: '4'}
64+
{a: '7', b: '6', c: '8'}
65+
] unless err
66+
next err
67+
68+
it 'with array', (next) ->
69+
columns = ['a', 'b', 'a', 'c']
70+
parse '''
71+
1,2,3,4
72+
5,6,7,8
73+
''', columns: columns, (err, data) ->
74+
data.should.eql [
75+
{a: '3', b: '2', c: '4'}
76+
{a: '7', b: '6', c: '8'}
77+
] unless err
78+
next err
79+
5480
describe 'boolean', ->
5581

5682
it 'read from first row if true', (next) ->

0 commit comments

Comments
 (0)