File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 2626 "build:dev" : " webpack" ,
2727 "test" : " npm run build:prod && jest" ,
2828 "test:dev" : " npm run build:dev && jest" ,
29+ "test:debug" : " node --inspect=9229 node_modules/jest/bin/jest.js --runInBand" ,
2930 "prepublishOnly" : " npm run build:prod" ,
3031 "prepare" : " jest --clearCache" ,
3132 "release" : " npm publish dist"
3233 }
33- }
34+ }
Original file line number Diff line number Diff line change 1+ import arrayToObjectKeys from "../dist"
2+
3+ it ( "should run with 1 argument" , ( ) => {
4+ const result = arrayToObjectKeys ( [ "a" , "b" ] )
5+ expect ( result ) . toEqual ( {
6+ a : null ,
7+ b : null ,
8+ } )
9+ } )
10+
11+ it ( "should run with an integer as second argument" , ( ) => {
12+ const result = arrayToObjectKeys ( [ "a" , "b" ] , 7 )
13+ expect ( result ) . toEqual ( {
14+ a : 7 ,
15+ b : 7 ,
16+ } )
17+ } )
18+
19+ it ( "should run with a function as second argument" , ( ) => {
20+ const valueGenerator = ( key , index ) => `${ index + 1 } -${ key } -x`
21+ const result = arrayToObjectKeys ( [ "a" , "b" ] , valueGenerator )
22+ expect ( result ) . toEqual ( {
23+ a : "1-a-x" ,
24+ b : "2-b-x" ,
25+ } )
26+ } )
You can’t perform that action at this time.
0 commit comments