@@ -158,25 +158,10 @@ describe('parse', () => {
158
158
op ( "ne" , "userType" , "Employee" )
159
159
)
160
160
) ;
161
- test (
162
- `userType eq "Employee" and not (emails co "example.com" or emails co "example.org") and userType ne "Employee"` ,
163
- and (
164
- op ( "eq" , "userType" , "Employee" ) ,
165
- {
166
- op : "not" ,
167
- filter : or (
168
- op ( "co" , "emails" , "example.com" ) ,
169
- op ( "co" , "emails" , "example.org" )
170
- )
171
- } ,
172
- op ( "ne" , "userType" , "Employee" )
173
- )
174
- ) ;
175
- test (
176
- `userType eq "Employee" or not (emails co "example.com" or emails co "example.org") and userType ne "Employee"` ,
177
- or (
178
- op ( "eq" , "userType" , "Employee" ) ,
161
+ test (
162
+ `userType eq "Employee" and not (emails co "example.com" or emails co "example.org") and userType ne "Employee"` ,
179
163
and (
164
+ op ( "eq" , "userType" , "Employee" ) ,
180
165
{
181
166
op : "not" ,
182
167
filter : or (
@@ -186,8 +171,56 @@ describe('parse', () => {
186
171
} ,
187
172
op ( "ne" , "userType" , "Employee" )
188
173
)
189
- )
190
- ) ;
174
+ ) ;
175
+ test (
176
+ `userType eq "Employee" or not (emails co "example.com" or emails co "example.org") and userType ne "Employee"` ,
177
+ or (
178
+ op ( "eq" , "userType" , "Employee" ) ,
179
+ and (
180
+ {
181
+ op : "not" ,
182
+ filter : or (
183
+ op ( "co" , "emails" , "example.com" ) ,
184
+ op ( "co" , "emails" , "example.org" )
185
+ )
186
+ } ,
187
+ op ( "ne" , "userType" , "Employee" )
188
+ )
189
+ )
190
+ ) ;
191
+ test (
192
+ `(userType eq "Employee" or userType eq "Employer") and emails sw "foo" and not (emails co "example.com" or emails co "example.org")` ,
193
+ and (
194
+ or (
195
+ op ( "eq" , "userType" , "Employee" ) ,
196
+ op ( "eq" , "userType" , "Employer" ) ,
197
+ ) ,
198
+ op ( "sw" , "emails" , "foo" ) ,
199
+ {
200
+ op : "not" ,
201
+ filter : or (
202
+ op ( "co" , "emails" , "example.com" ) ,
203
+ op ( "co" , "emails" , "example.org" )
204
+ )
205
+ } ,
206
+ )
207
+ ) ;
208
+ test (
209
+ `userType eq "Employee" and (emails sw "foo" or not (emails co "example.com" or emails co "example.org"))` ,
210
+ and (
211
+ op ( "eq" , "userType" , "Employee" ) ,
212
+ or (
213
+ op ( "sw" , "emails" , "foo" ) ,
214
+ {
215
+ op : "not" ,
216
+ filter : or (
217
+ op ( "co" , "emails" , "example.com" ) ,
218
+ op ( "co" , "emails" , "example.org" )
219
+ )
220
+ } ,
221
+ ) ,
222
+ )
223
+ ) ;
191
224
test (
192
225
`userType eq "Employee" and (emails.type eq "work")` ,
193
226
and ( eq ( "userType" , "Employee" ) , eq ( "emails.type" , "work" ) )
0 commit comments