@@ -30,9 +30,7 @@ describe('plugin:cache', function() {
3030 config . init ( ) ;
3131 plugin . init ( ) ;
3232
33- h . getCacheDir = function ( ) {
34- return HOME ;
35- } ;
33+ h . getCacheDir = ( ) => HOME ;
3634 cache . __set__ ( 'h' , h ) ;
3735 cache . init ( ) ;
3836
@@ -60,10 +58,7 @@ describe('plugin:cache', function() {
6058
6159 it ( 'should getProblems w/o cache ok' , function ( done ) {
6260 cache . del ( 'problems' ) ;
63-
64- NEXT . getProblems = function ( cb ) {
65- return cb ( null , PROBLEMS ) ;
66- } ;
61+ NEXT . getProblems = cb => cb ( null , PROBLEMS ) ;
6762
6863 plugin . getProblems ( function ( e , problems ) {
6964 assert . equal ( e , null ) ;
@@ -74,10 +69,7 @@ describe('plugin:cache', function() {
7469
7570 it ( 'should getProblems w/o cache fail if client error' , function ( done ) {
7671 cache . del ( 'problems' ) ;
77-
78- NEXT . getProblems = function ( cb ) {
79- return cb ( 'client getProblems error' ) ;
80- } ;
72+ NEXT . getProblems = cb => cb ( 'client getProblems error' ) ;
8173
8274 plugin . getProblems ( function ( e , problems ) {
8375 assert . equal ( e , 'client getProblems error' ) ;
@@ -101,10 +93,7 @@ describe('plugin:cache', function() {
10193 it ( 'should getProblem w/o cache ok' , function ( done ) {
10294 cache . set ( 'problems' , PROBLEMS ) ;
10395 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 ] ) ;
10897
10998 plugin . getProblem ( _ . clone ( PROBLEM ) , function ( e , problem ) {
11099 assert . equal ( e , null ) ;
@@ -116,10 +105,7 @@ describe('plugin:cache', function() {
116105 it ( 'should getProblem fail if client error' , function ( done ) {
117106 cache . set ( 'problems' , PROBLEMS ) ;
118107 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' ) ;
123109
124110 plugin . getProblem ( _ . clone ( PROBLEM ) , function ( e , problem ) {
125111 assert . equal ( e , 'client getProblem error' ) ;
@@ -185,9 +171,7 @@ describe('plugin:cache', function() {
185171 assert . equal ( session . getUser ( ) , null ) ;
186172 assert . equal ( session . isLogin ( ) , false ) ;
187173
188- NEXT . login = function ( user , cb ) {
189- return cb ( null , user ) ;
190- } ;
174+ NEXT . login = ( user , cb ) => cb ( null , user ) ;
191175
192176 plugin . login ( USER , function ( e , user ) {
193177 assert . equal ( e , null ) ;
@@ -204,9 +188,7 @@ describe('plugin:cache', function() {
204188 config . autologin . enable = false ;
205189 cache . del ( h . KEYS . user ) ;
206190
207- NEXT . login = function ( user , cb ) {
208- return cb ( null , user ) ;
209- } ;
191+ NEXT . login = ( user , cb ) => cb ( null , user ) ;
210192
211193 plugin . login ( USER , function ( e , user ) {
212194 assert . equal ( e , null ) ;
@@ -218,9 +200,7 @@ describe('plugin:cache', function() {
218200 } ) ;
219201
220202 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' ) ;
224204
225205 plugin . login ( USER , function ( e , user ) {
226206 assert . equal ( e , 'client login error' ) ;
0 commit comments