File tree Expand file tree Collapse file tree 3 files changed +1280
-39
lines changed Expand file tree Collapse file tree 3 files changed +1280
-39
lines changed Original file line number Diff line number Diff line change 1212 "homepage" : " https://github.com/vkalinichev/rutor-api" ,
1313 "main" : " lib/index.js" ,
1414 "dependencies" : {
15+ "ava" : " ^0.17.0" ,
1516 "cheerio" : " ^0.22.0" ,
1617 "request" : " ^2.79.0"
1718 },
2627 "build" : " babel src -d lib" ,
2728 "prepublish" : " npm run build && npm test" ,
2829 "lint" : " eslint lib/*.js" ,
29- "test" : " echo \" Error: no test specified \" && exit 1 "
30+ "test" : " ava "
3031 },
3132 "engines" : {
3233 "node" : " >=4"
Original file line number Diff line number Diff line change 1+ const { test } = require ( 'ava' )
2+ const { config } = require ( '.' )
3+
4+ test ( 'Default config loaded' , t => {
5+ const actual = config ( { } )
6+ const expected = {
7+ base : 'http://tor-ru.net/search/' ,
8+ page : 0 ,
9+ category : 0 ,
10+ method : 100 ,
11+ order : 0
12+ }
13+ t . deepEqual ( actual , expected )
14+ } )
15+
16+ test ( 'Explicit config overrides defaults' , t => {
17+ const actual = config ( { base : 'http://rutor.org/search/' } )
18+ const expected = {
19+ base : 'http://rutor.org/search/' ,
20+ page : 0 ,
21+ category : 0 ,
22+ method : 100 ,
23+ order : 0
24+ }
25+ t . deepEqual ( actual , expected )
26+ } )
27+
You can’t perform that action at this time.
0 commit comments