@@ -2,20 +2,20 @@ import filterColumns from '../src/filterColumns';
2
2
3
3
const data = [
4
4
[ 'lat' , 'lng' , 'country' ] ,
5
- [ '0.234 ' , '1.47' , 'SomeCountria' ] ,
6
- [ '-293.2 ' , '103.34' , 'SomeOtherCountria' ] ,
5
+ [ '0' , '1.47' , 'SomeCountria' ] ,
6
+ [ '1 ' , '103.34' , 'SomeOtherCountria' ] ,
7
7
] ;
8
8
9
9
test ( 'Filtering a single column works correctly' , ( ) => {
10
10
const result = filterColumns ( data , [ 'lng' ] ) ;
11
11
expect ( result ) . toMatchObject ( [ [ 'lng' ] , [ '1.47' ] , [ '103.34' ] ] ) ;
12
12
} ) ;
13
13
14
- test ( 'Filtering multiple columns works correctly' , ( ) => {
15
- const result = filterColumns ( data , [ 'country' , 'lng ' ] ) ; // Column order from the CSV should be preserved.
14
+ test ( 'Filtering multiple columns works correctly, respects order in second argument, does not break with multiple same name columns ' , ( ) => {
15
+ const result = filterColumns ( data , [ 'country' , 'lat ' ] ) ; // Column order from the CSV should be preserved.
16
16
expect ( result ) . toMatchObject ( [
17
- [ 'lng ' , 'country ' ] ,
18
- [ '1.47 ' , 'SomeCountria ' ] ,
19
- [ '103.34 ' , 'SomeOtherCountria ' ] ,
17
+ [ 'country ' , 'lat ' ] ,
18
+ [ 'SomeCountria ' , '0 ' ] ,
19
+ [ 'SomeOtherCountria ' , '1 ' ] ,
20
20
] ) ;
21
21
} ) ;
0 commit comments