@@ -30,9 +30,7 @@ describe('plugin:cache', function() {
30
30
config . init ( ) ;
31
31
plugin . init ( ) ;
32
32
33
- h . getCacheDir = function ( ) {
34
- return HOME ;
35
- } ;
33
+ h . getCacheDir = ( ) => HOME ;
36
34
cache . __set__ ( 'h' , h ) ;
37
35
cache . init ( ) ;
38
36
@@ -60,10 +58,7 @@ describe('plugin:cache', function() {
60
58
61
59
it ( 'should getProblems w/o cache ok' , function ( done ) {
62
60
cache . del ( 'problems' ) ;
63
-
64
- NEXT . getProblems = function ( cb ) {
65
- return cb ( null , PROBLEMS ) ;
66
- } ;
61
+ NEXT . getProblems = cb => cb ( null , PROBLEMS ) ;
67
62
68
63
plugin . getProblems ( function ( e , problems ) {
69
64
assert . equal ( e , null ) ;
@@ -74,10 +69,7 @@ describe('plugin:cache', function() {
74
69
75
70
it ( 'should getProblems w/o cache fail if client error' , function ( done ) {
76
71
cache . del ( 'problems' ) ;
77
-
78
- NEXT . getProblems = function ( cb ) {
79
- return cb ( 'client getProblems error' ) ;
80
- } ;
72
+ NEXT . getProblems = cb => cb ( 'client getProblems error' ) ;
81
73
82
74
plugin . getProblems ( function ( e , problems ) {
83
75
assert . equal ( e , 'client getProblems error' ) ;
@@ -101,10 +93,7 @@ describe('plugin:cache', function() {
101
93
it ( 'should getProblem w/o cache ok' , function ( done ) {
102
94
cache . set ( 'problems' , PROBLEMS ) ;
103
95
cache . del ( '0.slug0.algorithms' ) ;
104
-
105
- NEXT . getProblem = function ( problem , cb ) {
106
- return cb ( null , PROBLEMS [ 0 ] ) ;
107
- } ;
96
+ NEXT . getProblem = ( problem , cb ) => cb ( null , PROBLEMS [ 0 ] ) ;
108
97
109
98
plugin . getProblem ( _ . clone ( PROBLEM ) , function ( e , problem ) {
110
99
assert . equal ( e , null ) ;
@@ -116,10 +105,7 @@ describe('plugin:cache', function() {
116
105
it ( 'should getProblem fail if client error' , function ( done ) {
117
106
cache . set ( 'problems' , PROBLEMS ) ;
118
107
cache . del ( '0.slug0.algorithms' ) ;
119
-
120
- NEXT . getProblem = function ( problem , cb ) {
121
- return cb ( 'client getProblem error' ) ;
122
- } ;
108
+ NEXT . getProblem = ( problem , cb ) => cb ( 'client getProblem error' ) ;
123
109
124
110
plugin . getProblem ( _ . clone ( PROBLEM ) , function ( e , problem ) {
125
111
assert . equal ( e , 'client getProblem error' ) ;
@@ -185,9 +171,7 @@ describe('plugin:cache', function() {
185
171
assert . equal ( session . getUser ( ) , null ) ;
186
172
assert . equal ( session . isLogin ( ) , false ) ;
187
173
188
- NEXT . login = function ( user , cb ) {
189
- return cb ( null , user ) ;
190
- } ;
174
+ NEXT . login = ( user , cb ) => cb ( null , user ) ;
191
175
192
176
plugin . login ( USER , function ( e , user ) {
193
177
assert . equal ( e , null ) ;
@@ -204,9 +188,7 @@ describe('plugin:cache', function() {
204
188
config . autologin . enable = false ;
205
189
cache . del ( h . KEYS . user ) ;
206
190
207
- NEXT . login = function ( user , cb ) {
208
- return cb ( null , user ) ;
209
- } ;
191
+ NEXT . login = ( user , cb ) => cb ( null , user ) ;
210
192
211
193
plugin . login ( USER , function ( e , user ) {
212
194
assert . equal ( e , null ) ;
@@ -218,9 +200,7 @@ describe('plugin:cache', function() {
218
200
} ) ;
219
201
220
202
it ( 'should login fail if client login error' , function ( done ) {
221
- NEXT . login = function ( user , cb ) {
222
- return cb ( 'client login error' ) ;
223
- } ;
203
+ NEXT . login = ( user , cb ) => cb ( 'client login error' ) ;
224
204
225
205
plugin . login ( USER , function ( e , user ) {
226
206
assert . equal ( e , 'client login error' ) ;
0 commit comments