File tree 4 files changed +24
-1
lines changed
4 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ function initConfig() {
23
23
var config = defaultConfig ;
24
24
25
25
// check local config: ~/.lcconfig
26
- var f = h . getHomeDir ( ) + '/.lcconfig' ;
26
+ var f = h . getConfigFile ( ) ;
27
27
if ( fs . existsSync ( f ) ) {
28
28
var localConfig = JSON . parse ( fs . readFileSync ( f ) ) ;
29
29
_ . extend ( defaultConfig , localConfig ) ;
Original file line number Diff line number Diff line change 43
43
"eslint" : " ^3.3.1" ,
44
44
"eslint-config-google" : " ^0.6.0" ,
45
45
"mocha" : " ^3.0.2" ,
46
+ "nock" : " ^8.0.0" ,
46
47
"nyc" : " ^8.1.0"
47
48
}
48
49
}
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