@@ -87,16 +87,15 @@ describe("BoxOfQuestions", function() {
8787 // setup a particular set of step value
8888
8989 var allWords = LW . db . allWords ( ) ;
90- // FIXME why do I need to indicate 0 as a string value?
91- allWords [ 0 ] . step = 0 ; // has not been answered yet
90+ allWords [ 0 ] . step = 0 ; // question for word has not been answered yet
9291 allWords [ 1 ] . step = 0 ;
9392 allWords [ 2 ] . step = 0 ;
94- allWords [ 3 ] . step = 0 ;
9593
96- allWords [ 4 ] . step = 1 ; // word has been answered once
94+ allWords [ 3 ] . step = 1 ; // question for word has been answered once
95+ allWords [ 4 ] . step = 1 ;
9796 allWords [ 5 ] . step = 1 ;
9897 allWords [ 6 ] . step = 2 ; // word has been answered two times
99- allWords [ 7 ] . step = 2 ;
98+ allWords [ 7 ] . step = 3 ; // word has been answered three times
10099
101100 LW . db . putWord ( allWords [ 0 ] ) ;
102101 LW . db . putWord ( allWords [ 1 ] ) ;
@@ -132,6 +131,8 @@ describe("BoxOfQuestions", function() {
132131 expect ( LW ) . toHaveMethod ( "importFrom" ) ;
133132 expect ( LW ) . toHaveMethod ( "wordsToRepeat" ) ;
134133
134+
135+ expect ( LW ) . toHaveMethod ( "wordsWithStepValue" ) ;
135136 expect ( LW ) . toHaveMethod ( "chooseRandomObject" ) ;
136137 expect ( LW ) . toHaveMethod ( "config" ) ;
137138 expect ( LW ) . toHaveMethod ( "status" ) ;
@@ -237,6 +238,29 @@ describe("BoxOfQuestions", function() {
237238
238239
239240
241+ it ( "should give an array of words having particular step values" , function ( ) {
242+
243+ expect ( LW ) . not . toBe ( null ) ;
244+ expect ( LW ) . toHaveMethod ( "wordsWithStepValue" ) ;
245+
246+ var wordWithStepEqualMinus1 = LW . wordsWithStepValue ( - 1 ) ;
247+ expect ( wordWithStepEqualMinus1 . length ) . toBe ( 4 ) ;
248+
249+ var wordsWithStep0 = LW . wordsWithStepValue ( 0 ) ;
250+ expect ( wordsWithStep0 . length ) . toBe ( 3 ) ;
251+
252+ var wordsWithStepMinus1ToZero = LW . wordsWithStepValue ( - 1 , 0 ) ;
253+ expect ( wordsWithStepMinus1ToZero . length ) . toBe ( 7 ) ;
254+
255+ var wordsWithStepMinus1ToPlus1 = LW . wordsWithStepValue ( - 1 , 1 ) ;
256+ expect ( wordsWithStepMinus1ToPlus1 . length ) . toBe ( 10 ) ;
257+
258+
259+ } ) ;
260+
261+
262+
263+
240264 it ( "should be able to give a question" , function ( ) {
241265
242266 expect ( LW ) . not . toBe ( null ) ;
@@ -457,7 +481,6 @@ describe("BoxOfQuestions", function() {
457481 sum = sum + _id ;
458482 }
459483
460- console . log ( ) ;
461484
462485 expect ( sum / 2000 >= 6.3 ) . toBe ( true ) ;
463486 expect ( sum / 2000 <= 6.7 ) . toBe ( true ) ;
0 commit comments