@@ -14,14 +14,15 @@ final class PostgrestFilterTests: XCTestCase {
14
14
configuration: PostgrestClient . Configuration (
15
15
url: URL ( string: " \( DotEnv . SUPABASE_URL) /rest/v1 " ) !,
16
16
headers: [
17
- " apikey " : DotEnv . SUPABASE_ANON_KEY,
17
+ " apikey " : DotEnv . SUPABASE_ANON_KEY
18
18
] ,
19
19
logger: nil
20
20
)
21
21
)
22
22
23
23
func testNot( ) async throws {
24
- let res = try await client. from ( " users " )
24
+ let res =
25
+ try await client. from ( " users " )
25
26
. select ( " status " )
26
27
. not ( " status " , operator: . eq, value: " OFFLINE " )
27
28
. execute ( )
@@ -44,7 +45,8 @@ final class PostgrestFilterTests: XCTestCase {
44
45
}
45
46
46
47
func testOr( ) async throws {
47
- let res = try await client. from ( " users " )
48
+ let res =
49
+ try await client. from ( " users " )
48
50
. select ( " status,username " )
49
51
. or ( " status.eq.OFFLINE,username.eq.supabot " )
50
52
. execute ( )
@@ -66,7 +68,8 @@ final class PostgrestFilterTests: XCTestCase {
66
68
}
67
69
68
70
func testEq( ) async throws {
69
- let res = try await client. from ( " users " )
71
+ let res =
72
+ try await client. from ( " users " )
70
73
. select ( " username " )
71
74
. eq ( " username " , value: " supabot " )
72
75
. execute ( )
@@ -83,7 +86,8 @@ final class PostgrestFilterTests: XCTestCase {
83
86
}
84
87
85
88
func testNeq( ) async throws {
86
- let res = try await client. from ( " users " )
89
+ let res =
90
+ try await client. from ( " users " )
87
91
. select ( " username " )
88
92
. neq ( " username " , value: " supabot " )
89
93
. execute ( )
@@ -106,7 +110,8 @@ final class PostgrestFilterTests: XCTestCase {
106
110
}
107
111
108
112
func testGt( ) async throws {
109
- let res = try await client. from ( " messages " )
113
+ let res =
114
+ try await client. from ( " messages " )
110
115
. select ( " id " )
111
116
. gt ( " id " , value: 1 )
112
117
. execute ( )
@@ -123,7 +128,8 @@ final class PostgrestFilterTests: XCTestCase {
123
128
}
124
129
125
130
func testGte( ) async throws {
126
- let res = try await client. from ( " messages " )
131
+ let res =
132
+ try await client. from ( " messages " )
127
133
. select ( " id " )
128
134
. gte ( " id " , value: 1 )
129
135
. execute ( )
@@ -143,7 +149,8 @@ final class PostgrestFilterTests: XCTestCase {
143
149
}
144
150
145
151
func testLe( ) async throws {
146
- let res = try await client. from ( " messages " )
152
+ let res =
153
+ try await client. from ( " messages " )
147
154
. select ( " id " )
148
155
. lt ( " id " , value: 2 )
149
156
. execute ( )
@@ -160,7 +167,8 @@ final class PostgrestFilterTests: XCTestCase {
160
167
}
161
168
162
169
func testLte( ) async throws {
163
- let res = try await client. from ( " messages " )
170
+ let res =
171
+ try await client. from ( " messages " )
164
172
. select ( " id " )
165
173
. lte ( " id " , value: 2 )
166
174
. execute ( )
@@ -180,7 +188,8 @@ final class PostgrestFilterTests: XCTestCase {
180
188
}
181
189
182
190
func testLike( ) async throws {
183
- let res = try await client. from ( " users " )
191
+ let res =
192
+ try await client. from ( " users " )
184
193
. select ( " username " )
185
194
. like ( " username " , pattern: " %supa% " )
186
195
. execute ( )
@@ -197,7 +206,8 @@ final class PostgrestFilterTests: XCTestCase {
197
206
}
198
207
199
208
func testLikeAllOf( ) async throws {
200
- let res = try await client. from ( " users " )
209
+ let res =
210
+ try await client. from ( " users " )
201
211
. select ( " username " )
202
212
. likeAllOf ( " username " , patterns: [ " %supa% " , " %bot% " ] )
203
213
. execute ( )
@@ -214,7 +224,8 @@ final class PostgrestFilterTests: XCTestCase {
214
224
}
215
225
216
226
func testLikeAnyOf( ) async throws {
217
- let res = try await client. from ( " users " )
227
+ let res =
228
+ try await client. from ( " users " )
218
229
. select ( " username " )
219
230
. likeAnyOf ( " username " , patterns: [ " %supa% " , " %kiwi% " ] )
220
231
. execute ( )
@@ -234,7 +245,8 @@ final class PostgrestFilterTests: XCTestCase {
234
245
}
235
246
236
247
func testIlike( ) async throws {
237
- let res = try await client. from ( " users " )
248
+ let res =
249
+ try await client. from ( " users " )
238
250
. select ( " username " )
239
251
. ilike ( " username " , pattern: " %SUPA% " )
240
252
. execute ( )
@@ -251,7 +263,8 @@ final class PostgrestFilterTests: XCTestCase {
251
263
}
252
264
253
265
func testIlikeAllOf( ) async throws {
254
- let res = try await client. from ( " users " )
266
+ let res =
267
+ try await client. from ( " users " )
255
268
. select ( " username " )
256
269
. iLikeAllOf ( " username " , patterns: [ " %SUPA% " , " %bot% " ] )
257
270
. execute ( )
@@ -268,7 +281,8 @@ final class PostgrestFilterTests: XCTestCase {
268
281
}
269
282
270
283
func testIlikeAnyOf( ) async throws {
271
- let res = try await client. from ( " users " )
284
+ let res =
285
+ try await client. from ( " users " )
272
286
. select ( " username " )
273
287
. iLikeAnyOf ( " username " , patterns: [ " %supa% " , " %KIWI% " ] )
274
288
. execute ( )
@@ -288,7 +302,8 @@ final class PostgrestFilterTests: XCTestCase {
288
302
}
289
303
290
304
func testIs( ) async throws {
291
- let res = try await client. from ( " users " ) . select ( " data " ) . is ( " data " , value: nil )
305
+ let res =
306
+ try await client. from ( " users " ) . select ( " data " ) . is ( " data " , value: nil )
292
307
. execute ( )
293
308
. value as AnyJSON
294
309
@@ -314,7 +329,8 @@ final class PostgrestFilterTests: XCTestCase {
314
329
315
330
func testIn( ) async throws {
316
331
let statuses = [ " ONLINE " , " OFFLINE " ]
317
- let res = try await client. from ( " users " ) . select ( " status " ) . in ( " status " , values: statuses)
332
+ let res =
333
+ try await client. from ( " users " ) . select ( " status " ) . in ( " status " , values: statuses)
318
334
. execute ( )
319
335
. value as AnyJSON
320
336
@@ -339,7 +355,8 @@ final class PostgrestFilterTests: XCTestCase {
339
355
}
340
356
341
357
func testContains( ) async throws {
342
- let res = try await client. from ( " users " ) . select ( " age_range " ) . contains ( " age_range " , value: " [1,2) " )
358
+ let res =
359
+ try await client. from ( " users " ) . select ( " age_range " ) . contains ( " age_range " , value: " [1,2) " )
343
360
. execute ( )
344
361
. value as AnyJSON
345
362
@@ -355,7 +372,8 @@ final class PostgrestFilterTests: XCTestCase {
355
372
}
356
373
357
374
func testContainedBy( ) async throws {
358
- let res = try await client. from ( " users " ) . select ( " age_range " ) . containedBy ( " age_range " , value: " [1,2) " )
375
+ let res =
376
+ try await client. from ( " users " ) . select ( " age_range " ) . containedBy ( " age_range " , value: " [1,2) " )
359
377
. execute ( )
360
378
. value as AnyJSON
361
379
@@ -371,7 +389,8 @@ final class PostgrestFilterTests: XCTestCase {
371
389
}
372
390
373
391
func testRangeLt( ) async throws {
374
- let res = try await client. from ( " users " ) . select ( " age_range " ) . rangeLt ( " age_range " , range: " [2,25) " )
392
+ let res =
393
+ try await client. from ( " users " ) . select ( " age_range " ) . rangeLt ( " age_range " , range: " [2,25) " )
375
394
. execute ( )
376
395
. value as AnyJSON
377
396
@@ -387,7 +406,8 @@ final class PostgrestFilterTests: XCTestCase {
387
406
}
388
407
389
408
func testRangeGt( ) async throws {
390
- let res = try await client. from ( " users " ) . select ( " age_range " ) . rangeGt ( " age_range " , range: " [2,25) " )
409
+ let res =
410
+ try await client. from ( " users " ) . select ( " age_range " ) . rangeGt ( " age_range " , range: " [2,25) " )
391
411
. execute ( )
392
412
. value as AnyJSON
393
413
@@ -406,7 +426,8 @@ final class PostgrestFilterTests: XCTestCase {
406
426
}
407
427
408
428
func testRangeLte( ) async throws {
409
- let res = try await client. from ( " users " ) . select ( " age_range " ) . rangeLte ( " age_range " , range: " [2,25) " )
429
+ let res =
430
+ try await client. from ( " users " ) . select ( " age_range " ) . rangeLte ( " age_range " , range: " [2,25) " )
410
431
. execute ( )
411
432
. value as AnyJSON
412
433
@@ -422,7 +443,8 @@ final class PostgrestFilterTests: XCTestCase {
422
443
}
423
444
424
445
func testRangeGte( ) async throws {
425
- let res = try await client. from ( " users " ) . select ( " age_range " ) . rangeGte ( " age_range " , range: " [2,25) " )
446
+ let res =
447
+ try await client. from ( " users " ) . select ( " age_range " ) . rangeGte ( " age_range " , range: " [2,25) " )
426
448
. execute ( )
427
449
. value as AnyJSON
428
450
@@ -444,7 +466,8 @@ final class PostgrestFilterTests: XCTestCase {
444
466
}
445
467
446
468
func testRangeAdjacent( ) async throws {
447
- let res = try await client. from ( " users " ) . select ( " age_range " ) . rangeAdjacent ( " age_range " , range: " [2,25) " )
469
+ let res =
470
+ try await client. from ( " users " ) . select ( " age_range " ) . rangeAdjacent ( " age_range " , range: " [2,25) " )
448
471
. execute ( )
449
472
. value as AnyJSON
450
473
@@ -466,7 +489,8 @@ final class PostgrestFilterTests: XCTestCase {
466
489
}
467
490
468
491
func testOverlaps( ) async throws {
469
- let res = try await client. from ( " users " ) . select ( " age_range " ) . overlaps ( " age_range " , value: " [2,25) " )
492
+ let res =
493
+ try await client. from ( " users " ) . select ( " age_range " ) . overlaps ( " age_range " , value: " [2,25) " )
470
494
. execute ( )
471
495
. value as AnyJSON
472
496
@@ -482,7 +506,8 @@ final class PostgrestFilterTests: XCTestCase {
482
506
}
483
507
484
508
func testTextSearch( ) async throws {
485
- let res = try await client. from ( " users " ) . select ( " catchphrase " )
509
+ let res =
510
+ try await client. from ( " users " ) . select ( " catchphrase " )
486
511
. textSearch ( " catchphrase " , query: " 'fat' & 'cat' " , config: " english " )
487
512
. execute ( )
488
513
. value as AnyJSON
@@ -499,7 +524,8 @@ final class PostgrestFilterTests: XCTestCase {
499
524
}
500
525
501
526
func testTextSearchWithPlain( ) async throws {
502
- let res = try await client. from ( " users " ) . select ( " catchphrase " )
527
+ let res =
528
+ try await client. from ( " users " ) . select ( " catchphrase " )
503
529
. textSearch ( " catchphrase " , query: " 'fat' & 'cat' " , config: " english " , type: . plain)
504
530
. execute ( )
505
531
. value as AnyJSON
@@ -516,7 +542,8 @@ final class PostgrestFilterTests: XCTestCase {
516
542
}
517
543
518
544
func testTextSearchWithPhrase( ) async throws {
519
- let res = try await client. from ( " users " ) . select ( " catchphrase " )
545
+ let res =
546
+ try await client. from ( " users " ) . select ( " catchphrase " )
520
547
. textSearch ( " catchphrase " , query: " cat " , config: " english " , type: . phrase)
521
548
. execute ( )
522
549
. value as AnyJSON
@@ -536,7 +563,8 @@ final class PostgrestFilterTests: XCTestCase {
536
563
}
537
564
538
565
func testTextSearchWithWebsearch( ) async throws {
539
- let res = try await client. from ( " users " ) . select ( " catchphrase " )
566
+ let res =
567
+ try await client. from ( " users " ) . select ( " catchphrase " )
540
568
. textSearch ( " catchphrase " , query: " 'fat' & 'cat' " , config: " english " , type: . websearch)
541
569
. execute ( )
542
570
. value as AnyJSON
@@ -553,7 +581,8 @@ final class PostgrestFilterTests: XCTestCase {
553
581
}
554
582
555
583
func testMultipleFilters( ) async throws {
556
- let res = try await client. from ( " users " )
584
+ let res =
585
+ try await client. from ( " users " )
557
586
. select ( )
558
587
. eq ( " username " , value: " supabot " )
559
588
. is ( " data " , value: nil )
@@ -579,7 +608,8 @@ final class PostgrestFilterTests: XCTestCase {
579
608
}
580
609
581
610
func testFilter( ) async throws {
582
- let res = try await client. from ( " users " )
611
+ let res =
612
+ try await client. from ( " users " )
583
613
. select ( " username " )
584
614
. filter ( " username " , operator: " eq " , value: " supabot " )
585
615
. execute ( )
@@ -597,7 +627,8 @@ final class PostgrestFilterTests: XCTestCase {
597
627
}
598
628
599
629
func testMatch( ) async throws {
600
- let res = try await client. from ( " users " )
630
+ let res =
631
+ try await client. from ( " users " )
601
632
. select ( " username,status " )
602
633
. match ( [ " username " : " supabot " , " status " : " ONLINE " ] )
603
634
. execute ( )
@@ -616,7 +647,8 @@ final class PostgrestFilterTests: XCTestCase {
616
647
}
617
648
618
649
func testFilterOnRpc( ) async throws {
619
- let res = try await client. rpc ( " get_username_and_status " , params: [ " name_param " : " supabot " ] )
650
+ let res =
651
+ try await client. rpc ( " get_username_and_status " , params: [ " name_param " : " supabot " ] )
620
652
. neq ( " status " , value: " ONLINE " )
621
653
. execute ( )
622
654
. value as AnyJSON
0 commit comments