@@ -67,6 +67,8 @@ describe("Filtering case insensitive string", () => {
67
67
filters : {
68
68
String : {
69
69
CASE_INSENSITIVE : true ,
70
+ GTE : true ,
71
+ MATCHES : true ,
70
72
} ,
71
73
} ,
72
74
} ,
@@ -77,19 +79,18 @@ describe("Filtering case insensitive string", () => {
77
79
await testHelper . close ( ) ;
78
80
} ) ;
79
81
80
- it ( "case insensitive eq " , async ( ) => {
82
+ test ( "case insensitive gte " , async ( ) => {
81
83
const query = /* GraphQL */ `
82
- query {
83
- ${ Movie . plural } (where: { title: { caseInsensitive: { eq: "the matrix" } } }) {
84
- title
85
- }
84
+ query {
85
+ ${ Movie . plural } (where: { title: { caseInsensitive: { gte: "The Matrix" } } }) {
86
+ title
86
87
}
87
- ` ;
88
+ }
89
+ ` ;
88
90
89
91
const result = await testHelper . executeGraphQL ( query ) ;
90
92
91
93
expect ( result . errors ) . toBeUndefined ( ) ;
92
-
93
94
expect ( result . data ) . toEqual ( {
94
95
[ Movie . plural ] : expect . toIncludeSameMembers ( [
95
96
{
@@ -102,30 +103,131 @@ describe("Filtering case insensitive string", () => {
102
103
} ) ;
103
104
} ) ;
104
105
105
- it ( "case insensitive eq on related type filter " , async ( ) => {
106
+ test ( "case insensitive in " , async ( ) => {
106
107
const query = /* GraphQL */ `
107
- query {
108
- ${ Person . plural } (where: { movies: { none: { title: { caseInsensitive: { eq: "the matrix" } } } } }) {
109
- name
110
- }
108
+ query {
109
+ ${ Movie . plural } (where: { title: { caseInsensitive: { in: ["the matrix", "THE LION KING"] } } }) {
110
+ title
111
111
}
112
- ` ;
112
+ }
113
+ ` ;
113
114
114
115
const result = await testHelper . executeGraphQL ( query ) ;
115
116
116
117
expect ( result . errors ) . toBeUndefined ( ) ;
118
+ expect ( result . data ) . toEqual ( {
119
+ [ Movie . plural ] : expect . toIncludeSameMembers ( [
120
+ {
121
+ title : "The Matrix" ,
122
+ } ,
123
+ {
124
+ title : "THE MATRIX" ,
125
+ } ,
126
+ {
127
+ title : "The Lion King" ,
128
+ } ,
129
+ ] ) ,
130
+ } ) ;
131
+ } ) ;
117
132
133
+ test ( "case insensitive contains" , async ( ) => {
134
+ const query = /* GraphQL */ `
135
+ query {
136
+ ${ Movie . plural } (where: { title: { caseInsensitive: { contains: "Matrix" } } }) {
137
+ title
138
+ }
139
+ }
140
+ ` ;
141
+
142
+ const result = await testHelper . executeGraphQL ( query ) ;
143
+
144
+ expect ( result . errors ) . toBeUndefined ( ) ;
118
145
expect ( result . data ) . toEqual ( {
119
- [ Person . plural ] : [
146
+ [ Movie . plural ] : expect . toIncludeSameMembers ( [
120
147
{
121
- name : "Arthur Dent " ,
148
+ title : "The Matrix " ,
122
149
} ,
123
- ] ,
150
+ {
151
+ title : "THE MATRIX" ,
152
+ } ,
153
+ ] ) ,
124
154
} ) ;
125
155
} ) ;
126
156
127
- it ( "case insensitive eq in connection " , async ( ) => {
157
+ test ( "case insensitive endsWith " , async ( ) => {
128
158
const query = /* GraphQL */ `
159
+ query {
160
+ ${ Movie . plural } (where: { title: { caseInsensitive: { endsWith: "RIX" } } }) {
161
+ title
162
+ }
163
+ }
164
+ ` ;
165
+
166
+ const result = await testHelper . executeGraphQL ( query ) ;
167
+
168
+ expect ( result . errors ) . toBeUndefined ( ) ;
169
+ expect ( result . data ) . toEqual ( {
170
+ [ Movie . plural ] : expect . toIncludeSameMembers ( [
171
+ {
172
+ title : "The Matrix" ,
173
+ } ,
174
+ {
175
+ title : "THE MATRIX" ,
176
+ } ,
177
+ ] ) ,
178
+ } ) ;
179
+ } ) ;
180
+
181
+ describe ( "eq" , ( ) => {
182
+ test ( "case insensitive eq" , async ( ) => {
183
+ const query = /* GraphQL */ `
184
+ query {
185
+ ${ Movie . plural } (where: { title: { caseInsensitive: { eq: "the matrix" } } }) {
186
+ title
187
+ }
188
+ }
189
+ ` ;
190
+
191
+ const result = await testHelper . executeGraphQL ( query ) ;
192
+
193
+ expect ( result . errors ) . toBeUndefined ( ) ;
194
+
195
+ expect ( result . data ) . toEqual ( {
196
+ [ Movie . plural ] : expect . toIncludeSameMembers ( [
197
+ {
198
+ title : "The Matrix" ,
199
+ } ,
200
+ {
201
+ title : "THE MATRIX" ,
202
+ } ,
203
+ ] ) ,
204
+ } ) ;
205
+ } ) ;
206
+
207
+ test ( "case insensitive eq on related type filter" , async ( ) => {
208
+ const query = /* GraphQL */ `
209
+ query {
210
+ ${ Person . plural } (where: { movies: { none: { title: { caseInsensitive: { eq: "the matrix" } } } } }) {
211
+ name
212
+ }
213
+ }
214
+ ` ;
215
+
216
+ const result = await testHelper . executeGraphQL ( query ) ;
217
+
218
+ expect ( result . errors ) . toBeUndefined ( ) ;
219
+
220
+ expect ( result . data ) . toEqual ( {
221
+ [ Person . plural ] : [
222
+ {
223
+ name : "Arthur Dent" ,
224
+ } ,
225
+ ] ,
226
+ } ) ;
227
+ } ) ;
228
+
229
+ test ( "case insensitive eq in connection" , async ( ) => {
230
+ const query = /* GraphQL */ `
129
231
query {
130
232
${ Movie . operations . connection } (where: { title: { caseInsensitive: { eq: "the matrix" } } }) {
131
233
edges {
@@ -137,30 +239,30 @@ describe("Filtering case insensitive string", () => {
137
239
}
138
240
` ;
139
241
140
- const result = await testHelper . executeGraphQL ( query ) ;
242
+ const result = await testHelper . executeGraphQL ( query ) ;
141
243
142
- expect ( result . errors ) . toBeUndefined ( ) ;
244
+ expect ( result . errors ) . toBeUndefined ( ) ;
143
245
144
- expect ( result . data ) . toEqual ( {
145
- [ Movie . operations . connection ] : {
146
- edges : expect . toIncludeSameMembers ( [
147
- {
148
- node : {
149
- title : "The Matrix" ,
246
+ expect ( result . data ) . toEqual ( {
247
+ [ Movie . operations . connection ] : {
248
+ edges : expect . toIncludeSameMembers ( [
249
+ {
250
+ node : {
251
+ title : "The Matrix" ,
252
+ } ,
150
253
} ,
151
- } ,
152
- {
153
- node : {
154
- title : "THE MATRIX" ,
254
+ {
255
+ node : {
256
+ title : "THE MATRIX" ,
257
+ } ,
155
258
} ,
156
- } ,
157
- ] ) ,
158
- } ,
259
+ ] ) ,
260
+ } ,
261
+ } ) ;
159
262
} ) ;
160
- } ) ;
161
263
162
- it ( "case insensitive eq on related node filter in connection" , async ( ) => {
163
- const query = /* GraphQL */ `
264
+ test ( "case insensitive eq on related node filter in connection" , async ( ) => {
265
+ const query = /* GraphQL */ `
164
266
query {
165
267
${ Person . operations . connection } (where: { moviesConnection: { none: { node: { title: { caseInsensitive: { eq: "the matrix" } } } } } }) {
166
268
edges {
@@ -172,25 +274,25 @@ describe("Filtering case insensitive string", () => {
172
274
}
173
275
` ;
174
276
175
- const result = await testHelper . executeGraphQL ( query ) ;
277
+ const result = await testHelper . executeGraphQL ( query ) ;
176
278
177
- expect ( result . errors ) . toBeUndefined ( ) ;
279
+ expect ( result . errors ) . toBeUndefined ( ) ;
178
280
179
- expect ( result . data ) . toEqual ( {
180
- [ Person . operations . connection ] : {
181
- edges : [
182
- {
183
- node : {
184
- name : "Arthur Dent" ,
281
+ expect ( result . data ) . toEqual ( {
282
+ [ Person . operations . connection ] : {
283
+ edges : [
284
+ {
285
+ node : {
286
+ name : "Arthur Dent" ,
287
+ } ,
185
288
} ,
186
- } ,
187
- ] ,
188
- } ,
289
+ ] ,
290
+ } ,
291
+ } ) ;
189
292
} ) ;
190
- } ) ;
191
293
192
- it ( "case insensitive eq on related edge filter in connection" , async ( ) => {
193
- const query = /* GraphQL */ `
294
+ test ( "case insensitive eq on related edge filter in connection" , async ( ) => {
295
+ const query = /* GraphQL */ `
194
296
query {
195
297
${ Person . operations . connection } (where: { moviesConnection: { none: { edge: { character: { caseInsensitive: { eq: "NEO" } } } } } }) {
196
298
edges {
@@ -202,20 +304,21 @@ describe("Filtering case insensitive string", () => {
202
304
}
203
305
` ;
204
306
205
- const result = await testHelper . executeGraphQL ( query ) ;
307
+ const result = await testHelper . executeGraphQL ( query ) ;
206
308
207
- expect ( result . errors ) . toBeUndefined ( ) ;
309
+ expect ( result . errors ) . toBeUndefined ( ) ;
208
310
209
- expect ( result . data ) . toEqual ( {
210
- [ Person . operations . connection ] : {
211
- edges : [
212
- {
213
- node : {
214
- name : "Arthur Dent" ,
311
+ expect ( result . data ) . toEqual ( {
312
+ [ Person . operations . connection ] : {
313
+ edges : [
314
+ {
315
+ node : {
316
+ name : "Arthur Dent" ,
317
+ } ,
215
318
} ,
216
- } ,
217
- ] ,
218
- } ,
319
+ ] ,
320
+ } ,
321
+ } ) ;
219
322
} ) ;
220
323
} ) ;
221
324
} ) ;
0 commit comments