@@ -41,8 +41,43 @@ describe('containsFilter', () => {
41
41
expect ( res ) . toBeTruthy ( ) ;
42
42
} ) ;
43
43
44
- it ( 'should be undefined if value is not string or object' , ( ) => {
45
- const res = containsFilter ( 1 , '1' , { } ) ;
46
- expect ( res ) . toBeUndefined ( ) ;
44
+ it ( 'should convert number to string and return true when filter matches' , ( ) => {
45
+ const res = containsFilter ( 123 , '123' , { } ) ;
46
+ expect ( res ) . toBeTruthy ( ) ;
47
+ } ) ;
48
+
49
+ it ( 'should convert number to string and return true when filter matches partially' , ( ) => {
50
+ const res = containsFilter ( 123 , '12' , { } ) ;
51
+ expect ( res ) . toBeTruthy ( ) ;
52
+ } ) ;
53
+
54
+ it ( 'should convert number to string and return false when filter does not match' , ( ) => {
55
+ const res = containsFilter ( 123 , '456' , { } ) ;
56
+ expect ( res ) . toBeFalsy ( ) ;
57
+ } ) ;
58
+
59
+ it ( 'should handle number filtering with case sensitive option' , ( ) => {
60
+ const res = containsFilter ( 123 , '123' , { filterCaseSensitive : true } ) ;
61
+ expect ( res ) . toBeTruthy ( ) ;
62
+ } ) ;
63
+
64
+ it ( 'should handle alphanumeric string filtering with numbers' , ( ) => {
65
+ const res = containsFilter ( 'ABC123' , '123' , { } ) ;
66
+ expect ( res ) . toBeTruthy ( ) ;
67
+ } ) ;
68
+
69
+ it ( 'should handle alphanumeric string filtering with partial numbers' , ( ) => {
70
+ const res = containsFilter ( 'ABC123' , '12' , { } ) ;
71
+ expect ( res ) . toBeTruthy ( ) ;
72
+ } ) ;
73
+
74
+ it ( 'should handle alphanumeric string filtering with letters and numbers' , ( ) => {
75
+ const res = containsFilter ( 'ABC123' , 'BC1' , { } ) ;
76
+ expect ( res ) . toBeTruthy ( ) ;
77
+ } ) ;
78
+
79
+ it ( 'should return false for alphanumeric string when filter does not match' , ( ) => {
80
+ const res = containsFilter ( 'ABC123' , 'XYZ' , { } ) ;
81
+ expect ( res ) . toBeFalsy ( ) ;
47
82
} ) ;
48
83
} ) ;
0 commit comments