@@ -40,8 +40,8 @@ describe('core', function() {
4040
4141 beforeEach ( function ( ) {
4242 next = { } ;
43- next . getProblems = cb => cb ( null , PROBLEMS ) ;
44- next . getProblem = ( p , cb ) => cb ( null , p ) ;
43+ next . getProblems = ( needTrans , cb ) => cb ( null , PROBLEMS ) ;
44+ next . getProblem = ( p , needTrans , cb ) => cb ( null , p ) ;
4545
4646 core = rewire ( '../lib/core' ) ;
4747 core . setNext ( next ) ;
@@ -68,7 +68,7 @@ describe('core', function() {
6868 let n = cases . length ;
6969
7070 for ( let x of cases ) {
71- core . filterProblems ( { query : x [ 0 ] } , function ( e , problems ) {
71+ core . filterProblems ( { query : x [ 0 ] , dontTranslate : false } , function ( e , problems ) {
7272 assert . notExists ( e ) ;
7373 assert . equal ( problems . length , x [ 1 ] . length ) ;
7474
@@ -90,7 +90,7 @@ describe('core', function() {
9090 let n = cases . length ;
9191
9292 for ( let x of cases ) {
93- core . filterProblems ( { tag : x [ 0 ] } , function ( e , problems ) {
93+ core . filterProblems ( { tag : x [ 0 ] , dontTranslate : false } , function ( e , problems ) {
9494 assert . notExists ( e ) ;
9595 assert . equal ( problems . length , x [ 1 ] . length ) ;
9696
@@ -102,7 +102,7 @@ describe('core', function() {
102102 } ) ;
103103
104104 it ( 'should fail if getProblems error' , function ( done ) {
105- next . getProblems = cb => cb ( 'getProblems error' ) ;
105+ next . getProblems = ( needT , cb ) => cb ( 'getProblems error' ) ;
106106 core . filterProblems ( { } , function ( e ) {
107107 assert . equal ( e , 'getProblems error' ) ;
108108 done ( ) ;
@@ -340,50 +340,51 @@ describe('core', function() {
340340 } ) ; // #exportProblem
341341
342342 describe ( '#getProblem' , function ( ) {
343- it ( 'should get by id ok' , function ( done ) {
344- core . getProblem ( 0 , function ( e , problem ) {
343+ it ( 'should get by id ok' , function ( done ) {
344+ // set needTranslate to false here because it's not used anyways
345+ core . getProblem ( 0 , false , function ( e , problem ) {
345346 assert . notExists ( e ) ;
346347 assert . deepEqual ( problem , PROBLEMS [ 0 ] ) ;
347348 done ( ) ;
348349 } ) ;
349350 } ) ;
350351
351352 it ( 'should get by key ok' , function ( done ) {
352- core . getProblem ( 'slug0' , function ( e , problem ) {
353+ core . getProblem ( 'slug0' , false , function ( e , problem ) {
353354 assert . notExists ( e ) ;
354355 assert . deepEqual ( problem , PROBLEMS [ 0 ] ) ;
355356 done ( ) ;
356357 } ) ;
357358 } ) ;
358359
359360 it ( 'should fail if not found' , function ( done ) {
360- core . getProblem ( 3 , function ( e , problem ) {
361+ core . getProblem ( 3 , false , function ( e , problem ) {
361362 assert . equal ( e , 'Problem not found!' ) ;
362363 done ( ) ;
363364 } ) ;
364365 } ) ;
365366
366367 it ( 'should fail if client error' , function ( done ) {
367- next . getProblem = ( problem , cb ) => cb ( 'client getProblem error' ) ;
368+ next . getProblem = ( problem , needT , cb ) => cb ( 'client getProblem error' ) ;
368369
369- core . getProblem ( 0 , function ( e , problem ) {
370+ core . getProblem ( 0 , false , function ( e , problem ) {
370371 assert . equal ( e , 'client getProblem error' ) ;
371372 done ( ) ;
372373 } ) ;
373374 } ) ;
374375
375376 it ( 'should ok if problem is already there' , function ( done ) {
376- core . getProblem ( PROBLEMS [ 1 ] , function ( e , problem ) {
377+ core . getProblem ( PROBLEMS [ 1 ] , false , function ( e , problem ) {
377378 assert . notExists ( e ) ;
378379 assert . deepEqual ( problem , PROBLEMS [ 1 ] ) ;
379380 done ( ) ;
380381 } ) ;
381382 } ) ;
382383
383384 it ( 'should fail if getProblems error' , function ( done ) {
384- next . getProblems = cb => cb ( 'getProblems error' ) ;
385+ next . getProblems = ( needT , cb ) => cb ( 'getProblems error' ) ;
385386
386- core . getProblem ( 0 , function ( e , problem ) {
387+ core . getProblem ( 0 , false , function ( e , problem ) {
387388 assert . equal ( e , 'getProblems error' ) ;
388389 done ( ) ;
389390 } ) ;
0 commit comments