@@ -4,10 +4,10 @@ describe('FilterByPipe', () => {
44 let pipe : FilterByPipe ;
55
66 const users = [
7- { id : 1 , first_name : 'John' , last_name : 'Doe' , work : { title : 'Software Engineer' , company : 'Foo Tech' , previous_company : 'Unknown' } } ,
8- { id : 2 , first_name : 'Jane' , last_name : 'West' , work : { title : 'Designer' , company : 'AAA Solutions' , previous_company : 'Unknown' } } ,
9- { id : 3 , first_name : 'Bruce' , last_name : 'John' , work : { title : 'Software Engineer' , company : 'Bar Tech' , previous_company : 'Unknown' } } ,
10- { id : 4 , first_name : 'William' , last_name : 'Cent' , work : { title : 'Designer' , company : 'Foo Tech' , previous_company : 'Bar Tech' } }
7+ { id : 1 , first_name : 'John' , last_name : 'Doe' , work : { title : 'Software Engineer' , company : 'Foo Tech' , previous_company : 'Unknown' } , current_employed : true } ,
8+ { id : 2 , first_name : 'Jane' , last_name : 'West' , work : { title : 'Designer' , company : 'AAA Solutions' , previous_company : 'Unknown' } , current_employed : false } ,
9+ { id : 3 , first_name : 'Bruce' , last_name : 'John' , work : { title : 'Software Engineer' , company : 'Bar Tech' , previous_company : 'Unknown' } , current_employed : true } ,
10+ { id : 4 , first_name : 'William' , last_name : 'Cent' , work : { title : 'Designer' , company : 'Foo Tech' , previous_company : 'Bar Tech' } , current_employed : false }
1111 ] ;
1212
1313 beforeEach ( ( ) => {
@@ -29,6 +29,14 @@ describe('FilterByPipe', () => {
2929 expect ( filtered [ 0 ] ) . toEqual ( users [ 0 ] ) ;
3030 } ) ;
3131
32+ it ( 'should filter by boolean value' , ( ) => {
33+ const filtered = pipe . transform ( users , [ 'current_employed' ] , true ) ;
34+
35+ expect ( filtered . length ) . toEqual ( 2 ) ;
36+ expect ( filtered [ 0 ] ) . toEqual ( users [ 0 ] ) ;
37+ expect ( filtered [ 1 ] ) . toEqual ( users [ 2 ] ) ;
38+ } ) ;
39+
3240 it ( 'should filter by multiple fields with a two result' , ( ) => {
3341 const filtered = pipe . transform ( users , [ 'first_name' , 'last_name' ] , 'John' ) ;
3442
0 commit comments