@@ -4,10 +4,10 @@ describe('FilterByPipe', () => {
4
4
let pipe : FilterByPipe ;
5
5
6
6
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 }
11
11
] ;
12
12
13
13
beforeEach ( ( ) => {
@@ -29,6 +29,14 @@ describe('FilterByPipe', () => {
29
29
expect ( filtered [ 0 ] ) . toEqual ( users [ 0 ] ) ;
30
30
} ) ;
31
31
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
+
32
40
it ( 'should filter by multiple fields with a two result' , ( ) => {
33
41
const filtered = pipe . transform ( users , [ 'first_name' , 'last_name' ] , 'John' ) ;
34
42
0 commit comments