@@ -129,55 +129,55 @@ describe(`filter`, () => {
129
129
{ id : 2 , tags : [ 'python' , 'typescript' ] } ,
130
130
{ id : 3 , tags : [ 'java' ] } ,
131
131
{ id : 4 , tags : [ ] } ,
132
- { id : 5 }
132
+ { id : 5 } ,
133
133
] ;
134
134
135
135
it ( 'should filter by array value' , ( ) => {
136
136
const result = filter ( new QueryParser ( 'tags:typescript' ) , data ) ;
137
137
expect ( result ) . toEqual ( [
138
138
{ id : 1 , tags : [ 'javascript' , 'typescript' ] } ,
139
- { id : 2 , tags : [ 'python' , 'typescript' ] }
139
+ { id : 2 , tags : [ 'python' , 'typescript' ] } ,
140
140
] ) ;
141
141
} ) ;
142
142
143
143
it ( 'should handle nested array fields' , ( ) => {
144
144
const nestedData = [
145
- {
145
+ {
146
146
id : 1 ,
147
147
nested : {
148
- tags : [ 'javascript' , 'typescript' ]
149
- }
148
+ tags : [ 'javascript' , 'typescript' ] ,
149
+ } ,
150
150
} ,
151
- {
151
+ {
152
152
id : 2 ,
153
153
nested : {
154
- tags : [ 'python' ]
155
- }
154
+ tags : [ 'python' ] ,
155
+ } ,
156
156
} ,
157
- {
157
+ {
158
158
id : 3 ,
159
159
nested : {
160
- other : [ 'something' ]
161
- }
162
- }
160
+ other : [ 'something' ] ,
161
+ } ,
162
+ } ,
163
163
] ;
164
164
165
165
const queries = [
166
- 'nested.tags:typescript' , // explicit field path
167
- '*.tags:typescript' , // wildcard prefix
168
- 'nested.tags*:typescript' , // wildcard suffix
169
- '*.tags*:typescript' // wildcard on both sides
166
+ 'nested.tags:typescript' , // explicit field path
167
+ '*.tags:typescript' , // wildcard prefix
168
+ 'nested.tags*:typescript' , // wildcard suffix
169
+ '*.tags*:typescript' , // wildcard on both sides
170
170
] ;
171
171
172
172
for ( const query of queries ) {
173
173
const result = filter ( new QueryParser ( query ) , nestedData ) ;
174
174
expect ( result ) . toEqual ( [
175
- {
176
- id : 1 ,
177
- nested : {
178
- tags : [ 'javascript' , 'typescript' ]
179
- }
180
- }
175
+ {
176
+ id : 1 ,
177
+ nested : {
178
+ tags : [ 'javascript' , 'typescript' ] ,
179
+ } ,
180
+ } ,
181
181
] ) ;
182
182
}
183
183
} ) ;
0 commit comments