@@ -11,17 +11,17 @@ describe("About Higher Order Functions", function () {
1111 var numbers = [ 1 , 2 , 3 ] ;
1212 var odd = _ ( numbers ) . filter ( function ( x ) { return x % 2 !== 0 } ) ;
1313
14- expect ( odd ) . toEqual ( FILL_ME_IN ) ;
15- expect ( odd . length ) . toBe ( FILL_ME_IN ) ;
16- expect ( numbers . length ) . toBe ( FILL_ME_IN ) ;
14+ expect ( odd ) . toEqual ( [ 1 , 3 ] ) ;
15+ expect ( odd . length ) . toBe ( 2 ) ;
16+ expect ( numbers . length ) . toBe ( 3 ) ;
1717 } ) ;
1818
1919 it ( "should use 'map' to transform each element" , function ( ) {
2020 var numbers = [ 1 , 2 , 3 ] ;
2121 var numbersPlus1 = _ ( numbers ) . map ( function ( x ) { return x + 1 } ) ;
2222
23- expect ( numbersPlus1 ) . toEqual ( FILL_ME_IN ) ;
24- expect ( numbers ) . toEqual ( FILL_ME_IN ) ;
23+ expect ( numbersPlus1 ) . toEqual ( [ 2 , 3 , 4 ] ) ;
24+ expect ( numbers ) . toEqual ( [ 1 , 2 , 3 ] ) ;
2525 } ) ;
2626
2727 it ( "should use 'reduce' to update the same result on each iteration" , function ( ) {
@@ -34,8 +34,8 @@ describe("About Higher Order Functions", function () {
3434 /* initial */ 0
3535 ) ;
3636
37- expect ( reduction ) . toBe ( FILL_ME_IN ) ;
38- expect ( numbers ) . toEqual ( FILL_ME_IN ) ;
37+ expect ( reduction ) . toBe ( 6 ) ;
38+ expect ( numbers ) . toEqual ( [ 1 , 2 , 3 ] ) ;
3939 } ) ;
4040
4141 it ( "should use 'forEach' for simple iteration" , function ( ) {
@@ -47,8 +47,8 @@ describe("About Higher Order Functions", function () {
4747
4848 _ ( numbers ) . forEach ( isEven ) ;
4949
50- expect ( msg ) . toEqual ( FILL_ME_IN ) ;
51- expect ( numbers ) . toEqual ( FILL_ME_IN ) ;
50+ expect ( msg ) . toEqual ( 'falsetruefalse' ) ;
51+ expect ( numbers ) . toEqual ( [ 1 , 2 , 3 ] ) ;
5252 } ) ;
5353
5454 it ( "should use 'all' to test whether all items pass condition" , function ( ) {
@@ -57,8 +57,8 @@ describe("About Higher Order Functions", function () {
5757
5858 var isEven = function ( x ) { return x % 2 === 0 } ;
5959
60- expect ( _ ( onlyEven ) . all ( isEven ) ) . toBe ( FILL_ME_IN ) ;
61- expect ( _ ( mixedBag ) . all ( isEven ) ) . toBe ( FILL_ME_IN ) ;
60+ expect ( _ ( onlyEven ) . all ( isEven ) ) . toBe ( true ) ;
61+ expect ( _ ( mixedBag ) . all ( isEven ) ) . toBe ( false ) ;
6262 } ) ;
6363
6464 it ( "should use 'any' to test if any items passes condition" , function ( ) {
@@ -67,18 +67,18 @@ describe("About Higher Order Functions", function () {
6767
6868 var isEven = function ( x ) { return x % 2 === 0 } ;
6969
70- expect ( _ ( onlyEven ) . any ( isEven ) ) . toBe ( FILL_ME_IN ) ;
71- expect ( _ ( mixedBag ) . any ( isEven ) ) . toBe ( FILL_ME_IN ) ;
70+ expect ( _ ( onlyEven ) . any ( isEven ) ) . toBe ( true ) ;
71+ expect ( _ ( mixedBag ) . any ( isEven ) ) . toBe ( true ) ;
7272 } ) ;
7373
7474 it ( "should use range to generate an array" , function ( ) {
75- expect ( _ . range ( 3 ) ) . toEqual ( FILL_ME_IN ) ;
76- expect ( _ . range ( 1 , 4 ) ) . toEqual ( FILL_ME_IN ) ;
77- expect ( _ . range ( 0 , - 4 , - 1 ) ) . toEqual ( FILL_ME_IN ) ;
75+ expect ( _ . range ( 3 ) ) . toEqual ( [ 0 , 1 , 2 ] ) ;
76+ expect ( _ . range ( 1 , 4 ) ) . toEqual ( [ 1 , 2 , 3 ] ) ;
77+ expect ( _ . range ( 0 , - 4 , - 1 ) ) . toEqual ( [ 0 , - 1 , - 2 , - 3 ] ) ;
7878 } ) ;
7979
8080 it ( "should use flatten to make nested arrays easy to work with" , function ( ) {
81- expect ( _ ( [ [ 1 , 2 ] , [ 3 , 4 ] ] ) . flatten ( ) ) . toEqual ( FILL_ME_IN ) ;
81+ expect ( _ ( [ [ 1 , 2 ] , [ 3 , 4 ] ] ) . flatten ( ) ) . toEqual ( [ 1 , 2 , 3 , 4 ] ) ;
8282 } ) ;
8383
8484 it ( "should use chain() ... .value() to use multiple higher order functions" , function ( ) {
@@ -88,7 +88,7 @@ describe("About Higher Order Functions", function () {
8888 . reduce ( function ( sum , x ) { return sum + x } )
8989 . value ( ) ;
9090
91- expect ( result ) . toEqual ( FILL_ME_IN ) ;
91+ expect ( result ) . toEqual ( 6 ) ;
9292 } ) ;
9393
9494} ) ;
0 commit comments