@@ -270,103 +270,54 @@ test('abort signal', async () => {
270
270
271
271
test ( 'explain with json/text format' , async ( ) => {
272
272
const res1 = await postgrest . from ( 'users' ) . select ( ) . explain ( { format : 'json' } )
273
- expect ( res1 ) . toMatchInlineSnapshot ( `
273
+ expect ( res1 ) . toMatchInlineSnapshot (
274
+ {
275
+ data : [
276
+ {
277
+ Plan : expect . any ( Object ) ,
278
+ } ,
279
+ ] ,
280
+ } ,
281
+ `
274
282
Object {
275
283
"count": null,
276
284
"data": Array [
277
285
Object {
278
- "Plan": Object {
279
- "Async Capable": false,
280
- "Node Type": "Aggregate",
281
- "Parallel Aware": false,
282
- "Partial Mode": "Simple",
283
- "Plan Rows": 1,
284
- "Plan Width": 112,
285
- "Plans": Array [
286
- Object {
287
- "Alias": "users",
288
- "Async Capable": false,
289
- "Node Type": "Seq Scan",
290
- "Parallel Aware": false,
291
- "Parent Relationship": "Outer",
292
- "Plan Rows": 510,
293
- "Plan Width": 132,
294
- "Relation Name": "users",
295
- "Startup Cost": 0,
296
- "Total Cost": 15.1,
297
- },
298
- ],
299
- "Startup Cost": 17.65,
300
- "Strategy": "Plain",
301
- "Total Cost": 17.67,
302
- },
286
+ "Plan": Any<Object>,
303
287
},
304
288
],
305
289
"error": null,
306
290
"status": 200,
307
291
"statusText": "OK",
308
292
}
309
- ` )
293
+ `
294
+ )
310
295
311
296
const res2 = await postgrest . from ( 'users' ) . select ( ) . explain ( )
312
- expect ( res2 . data ) . toMatch (
313
- `Aggregate (cost=17.65..17.67 rows=1 width=112)
314
- -> Seq Scan on users (cost=0.00..15.10 rows=510 width=132)
315
- `
316
- )
297
+ expect ( res2 . data ) . toMatch ( / A g g r e g a t e \( c o s t = .* / )
317
298
} )
318
299
319
300
test ( 'explain with options' , async ( ) => {
320
301
const res = await postgrest
321
302
. from ( 'users' )
322
303
. select ( )
323
304
. explain ( { verbose : true , settings : true , format : 'json' } )
324
- expect ( res ) . toMatchInlineSnapshot ( `
305
+ expect ( res ) . toMatchInlineSnapshot (
306
+ {
307
+ data : [
308
+ {
309
+ Plan : expect . any ( Object ) ,
310
+ 'Query Identifier' : expect . any ( Number ) ,
311
+ } ,
312
+ ] ,
313
+ } ,
314
+ `
325
315
Object {
326
316
"count": null,
327
317
"data": Array [
328
318
Object {
329
- "Plan": Object {
330
- "Async Capable": false,
331
- "Node Type": "Aggregate",
332
- "Output": Array [
333
- "NULL::bigint",
334
- "count(ROW(users.username, users.data, users.age_range, users.status, users.catchphrase))",
335
- "COALESCE(json_agg(ROW(users.username, users.data, users.age_range, users.status, users.catchphrase)), '[]'::json)",
336
- "NULLIF(current_setting('response.headers'::text, true), ''::text)",
337
- "NULLIF(current_setting('response.status'::text, true), ''::text)",
338
- ],
339
- "Parallel Aware": false,
340
- "Partial Mode": "Simple",
341
- "Plan Rows": 1,
342
- "Plan Width": 112,
343
- "Plans": Array [
344
- Object {
345
- "Alias": "users",
346
- "Async Capable": false,
347
- "Node Type": "Seq Scan",
348
- "Output": Array [
349
- "users.username",
350
- "users.data",
351
- "users.age_range",
352
- "users.status",
353
- "users.catchphrase",
354
- ],
355
- "Parallel Aware": false,
356
- "Parent Relationship": "Outer",
357
- "Plan Rows": 510,
358
- "Plan Width": 132,
359
- "Relation Name": "users",
360
- "Schema": "public",
361
- "Startup Cost": 0,
362
- "Total Cost": 15.1,
363
- },
364
- ],
365
- "Startup Cost": 17.65,
366
- "Strategy": "Plain",
367
- "Total Cost": 17.67,
368
- },
369
- "Query Identifier": 3302819211508333000,
319
+ "Plan": Any<Object>,
320
+ "Query Identifier": Any<Number>,
370
321
"Settings": Object {
371
322
"effective_cache_size": "128MB",
372
323
"search_path": "\\"public\\", \\"extensions\\"",
@@ -377,7 +328,8 @@ test('explain with options', async () => {
377
328
"status": 200,
378
329
"statusText": "OK",
379
330
}
380
- ` )
331
+ `
332
+ )
381
333
} )
382
334
383
335
test ( 'rollback insert/upsert' , async ( ) => {
0 commit comments