@@ -720,6 +720,20 @@ describe('GridOdataService', () => {
720720 expect ( query ) . toBe ( expectation ) ;
721721 } ) ;
722722
723+ it ( 'should return a query with a CSV string when the filter operator is IN ' , ( ) => {
724+ const expectation = `$top=10&$filter=(Gender eq 'female' or Gender eq 'ma%2Fle')` ;
725+ const mockColumn = { id : 'gender' , field : 'gender' } as Column ;
726+ const mockColumnFilters = {
727+ gender : { columnId : 'gender' , columnDef : mockColumn , searchTerms : [ 'female' , 'ma/le' ] , operator : 'IN' } ,
728+ } as ColumnFilters ;
729+
730+ service . init ( serviceOptions , paginationOptions , gridStub ) ;
731+ service . updateFilters ( mockColumnFilters , false ) ;
732+ const query = service . buildQuery ( ) ;
733+
734+ expect ( query ) . toBe ( expectation ) ;
735+ } ) ;
736+
723737 it ( 'should return a query with a CSV string when the filter operator is IN for numeric column type' , ( ) => {
724738 const expectation = `$top=10&$filter=(Id eq 100 or Id eq 101)` ;
725739 const mockColumn = { id : 'id' , field : 'id' , type : FieldType . number } as Column ;
@@ -748,6 +762,20 @@ describe('GridOdataService', () => {
748762 expect ( query ) . toBe ( expectation ) ;
749763 } ) ;
750764
765+ it ( 'should return a query with a CSV string when the filter operator is NOT_IN' , ( ) => {
766+ const expectation = `$top=10&$filter=(Gender ne 'female' and Gender ne 'ma%2Fle')` ;
767+ const mockColumn = { id : 'gender' , field : 'gender' } as Column ;
768+ const mockColumnFilters = {
769+ gender : { columnId : 'gender' , columnDef : mockColumn , searchTerms : [ 'female' , 'ma/le' ] , operator : OperatorType . notIn } ,
770+ } as ColumnFilters ;
771+
772+ service . init ( serviceOptions , paginationOptions , gridStub ) ;
773+ service . updateFilters ( mockColumnFilters , false ) ;
774+ const query = service . buildQuery ( ) ;
775+
776+ expect ( query ) . toBe ( expectation ) ;
777+ } ) ;
778+
751779 it ( 'should return a query with a CSV string and use the operator from the Column Definition Operator when provided' , ( ) => {
752780 const expectation = `$top=10&$filter=(Gender ne 'female' and Gender ne 'male')` ;
753781 const mockColumn = { id : 'gender' , field : 'gender' , filter : { operator : OperatorType . notIn } } as Column ;
0 commit comments