@@ -10,18 +10,15 @@ describe('containsFilter', function() {
1010 } ) ) ;
1111
1212 it ( 'should get collection of primitives and use strict comparison(===)' , function ( ) {
13-
1413 expect ( filter ( [ 'foo' , 'bar' ] , 'bar' ) ) . toBeTruthy ( ) ;
1514 expect ( filter ( [ 1 , 2 , 3 , 4 ] , 4 ) ) . toBeTruthy ( ) ;
1615
1716 expect ( filter ( [ 'foo' , 'bar' ] , 'baz' ) ) . toBeFalsy ( ) ;
1817 expect ( filter ( [ 1 , 2 , 3 , 4 ] , - 1 ) ) . toBeFalsy ( ) ;
19-
2018 } ) ;
2119
2220 it ( 'should get array as collection and return if given expression is ' +
2321 'present in one or more object in the collection' , function ( ) {
24-
2522 var array = [
2623 { id : 1 , name : 'foo' } ,
2724 { id : 2 , name : 'baz' } ,
@@ -31,51 +28,43 @@ describe('containsFilter', function() {
3128
3229 expect ( filter ( array , 'id === 2' ) ) . toBeTruthy ( ) ;
3330 expect ( filter ( array , 'id >= 1 && name === \'foo\'' ) ) . toBeTruthy ( ) ;
34- expect ( filter ( array ) ) . toBeTruthy ( ) ;
31+ expect ( filter ( array ) ) . toBeFalsy ( ) ;
3532
3633 expect ( filter ( array , 'id > 77' ) ) . toBeFalsy ( ) ;
3734 expect ( filter ( array , 'name.indexOf(\'u\') !== -1' ) ) . toBeFalsy ( ) ;
38-
3935 } ) ;
4036
4137 it ( 'should get object as collection and return if given expression is ' +
4238 'present in one or more object in the collection' , function ( ) {
43-
4439 var object = {
4540 0 : { id : 1 , name : 'foo' } ,
4641 1 : { id : 2 , name : 'baz' } ,
4742 2 : { id : 1 , name : 'ariel' } ,
4843 3 : { id : 1 , name : 'bar' }
4944 } ;
5045
51-
5246 expect ( filter ( object , 'id === 2' ) ) . toBeTruthy ( ) ;
5347 expect ( filter ( object , 'id >= 1 && name === "foo"' ) ) . toBeTruthy ( ) ;
54- expect ( filter ( object ) ) . toBeTruthy ( ) ;
48+ expect ( filter ( object ) ) . toBeFalsy ( ) ;
5549
5650 expect ( filter ( object , 'id > 77' ) ) . toBeFalsy ( ) ;
5751 expect ( filter ( object , 'name.indexOf(\'u\') !== -1' ) ) . toBeFalsy ( ) ;
58-
5952 } ) ;
6053
6154 it ( 'should get function as expression' , function ( ) {
62-
6355 var array = [ 1 , 2 , 3 , 4 , 5 ] ;
6456
6557 function mod2 ( elm ) {
6658 return ! ( elm % 2 ) ;
6759 }
6860
6961 expect ( filter ( array , mod2 ) ) . toBeTruthy ( ) ;
70-
7162 } ) ;
7263
7364 it ( 'should get !collection and return always true' , function ( ) {
74-
75- expect ( filter ( 'lorem ipsum' ) ) . toBeTruthy ( ) ;
76- expect ( filter ( 1 , null ) ) . toBeTruthy ( ) ;
77- expect ( filter ( ! 1 ) ) . toBeTruthy ( ) ;
78-
65+ expect ( filter ( 'lorem ipsum' ) ) . toBeFalsy ( ) ;
66+ expect ( filter ( 1 , null ) ) . toBeFalsy ( ) ;
67+ expect ( filter ( ! 1 ) ) . toBeFalsy ( ) ;
7968 } ) ;
8069
8170} ) ;
0 commit comments