File tree Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ function initConfig() {
2323 var config = defaultConfig ;
2424
2525 // check local config: ~/.lcconfig
26- var f = h . getHomeDir ( ) + '/.lcconfig' ;
26+ var f = h . getConfigFile ( ) ;
2727 if ( fs . existsSync ( f ) ) {
2828 var localConfig = JSON . parse ( fs . readFileSync ( f ) ) ;
2929 _ . extend ( defaultConfig , localConfig ) ;
Original file line number Diff line number Diff line change 4343 "eslint" : " ^3.3.1" ,
4444 "eslint-config-google" : " ^0.6.0" ,
4545 "mocha" : " ^3.0.2" ,
46+ "nock" : " ^8.0.0" ,
4647 "nyc" : " ^8.1.0"
4748 }
4849}
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 1+ var assert = require ( 'chai' ) . assert ;
2+ var nock = require ( 'nock' ) ;
3+
4+ var client = require ( '../lib/leetcode_client' ) ;
5+ var config = require ( '../lib/config' ) ;
6+
7+ describe ( 'leetcode_client' , function ( ) {
8+ describe ( '#getProblems' , function ( ) {
9+ it ( 'should ok' , function ( done ) {
10+ nock ( config . PROBLEMS_URL )
11+ . get ( '/' )
12+ . replyWithFile ( 200 , './test/mock/problems.json' ) ;
13+
14+ client . getProblems ( function ( e , problems ) {
15+ assert . equal ( e , null ) ;
16+ assert . equal ( problems . length , 382 ) ;
17+ done ( ) ;
18+ } ) ;
19+ } ) ;
20+ } ) ; // #getProblems
21+ } ) ;
You can’t perform that action at this time.
0 commit comments