@@ -370,6 +370,56 @@ test('contains', async () => {
370
370
` )
371
371
} )
372
372
373
+ test ( 'contains with json' , async ( ) => {
374
+ const res = await postgrest
375
+ . from ( 'users' )
376
+ . select ( 'data' )
377
+ . contains ( 'data' , { foo : { baz : 'string value' } } )
378
+ expect ( res ) . toMatchInlineSnapshot ( `
379
+ Object {
380
+ "count": null,
381
+ "data": Array [
382
+ Object {
383
+ "data": Object {
384
+ "foo": Object {
385
+ "bar": Object {
386
+ "nested": "value",
387
+ },
388
+ "baz": "string value",
389
+ },
390
+ },
391
+ },
392
+ ],
393
+ "error": null,
394
+ "status": 200,
395
+ "statusText": "OK",
396
+ }
397
+ ` )
398
+ } )
399
+
400
+ test ( 'contains with array' , async ( ) => {
401
+ const res = await postgrest
402
+ . from ( 'cornercase' )
403
+ . select ( 'array_column' )
404
+ . contains ( 'array_column' , [ 'test' ] )
405
+ expect ( res ) . toMatchInlineSnapshot ( `
406
+ Object {
407
+ "count": null,
408
+ "data": Array [
409
+ Object {
410
+ "array_column": Array [
411
+ "test",
412
+ "one",
413
+ ],
414
+ },
415
+ ],
416
+ "error": null,
417
+ "status": 200,
418
+ "statusText": "OK",
419
+ }
420
+ ` )
421
+ } )
422
+
373
423
test ( 'containedBy' , async ( ) => {
374
424
const res = await postgrest . from ( 'users' ) . select ( 'age_range' ) . containedBy ( 'age_range' , '[1,2)' )
375
425
expect ( res ) . toMatchInlineSnapshot ( `
@@ -387,6 +437,38 @@ test('containedBy', async () => {
387
437
` )
388
438
} )
389
439
440
+ test ( 'containedBy with json' , async ( ) => {
441
+ const res = await postgrest
442
+ . from ( 'users' )
443
+ . select ( 'data' )
444
+ . containedBy ( 'data' , { foo : { baz : 'string value' } } )
445
+ expect ( res ) . toMatchInlineSnapshot ( `
446
+ Object {
447
+ "count": null,
448
+ "data": Array [],
449
+ "error": null,
450
+ "status": 200,
451
+ "statusText": "OK",
452
+ }
453
+ ` )
454
+ } )
455
+
456
+ test ( 'containedBy with array' , async ( ) => {
457
+ const res = await postgrest
458
+ . from ( 'cornercase' )
459
+ . select ( 'array_column' )
460
+ . containedBy ( 'array_column' , [ 'test' ] )
461
+ expect ( res ) . toMatchInlineSnapshot ( `
462
+ Object {
463
+ "count": null,
464
+ "data": Array [],
465
+ "error": null,
466
+ "status": 200,
467
+ "statusText": "OK",
468
+ }
469
+ ` )
470
+ } )
471
+
390
472
test ( 'rangeLt' , async ( ) => {
391
473
const res = await postgrest . from ( 'users' ) . select ( 'age_range' ) . rangeLt ( 'age_range' , '[2,25)' )
392
474
expect ( res ) . toMatchInlineSnapshot ( `
@@ -510,6 +592,29 @@ test('overlaps', async () => {
510
592
` )
511
593
} )
512
594
595
+ test ( 'overlaps with array' , async ( ) => {
596
+ const res = await postgrest
597
+ . from ( 'cornercase' )
598
+ . select ( 'array_column' )
599
+ . overlaps ( 'array_column' , [ 'test' ] )
600
+ expect ( res ) . toMatchInlineSnapshot ( `
601
+ Object {
602
+ "count": null,
603
+ "data": Array [
604
+ Object {
605
+ "array_column": Array [
606
+ "test",
607
+ "one",
608
+ ],
609
+ },
610
+ ],
611
+ "error": null,
612
+ "status": 200,
613
+ "statusText": "OK",
614
+ }
615
+ ` )
616
+ } )
617
+
513
618
test ( 'textSearch' , async ( ) => {
514
619
const res = await postgrest
515
620
. from ( 'users' )
0 commit comments