@@ -97,123 +97,109 @@ test('abort signal', async () => {
97
97
` )
98
98
} )
99
99
100
- test ( 'geojson' , async ( ) => {
101
- const res = await postgrest
102
- . from ( 'shops' )
103
- . select ( )
104
- . geojson ( )
105
- . then ( ( res ) => res . data )
100
+ // test('geojson', async () => {
101
+ // const res = await postgrest.from('shops').select().geojson()
102
+ // expect(res).toMatchInlineSnapshot()
103
+ // })
104
+
105
+ test ( 'explain' , async ( ) => {
106
+ const res = await postgrest . from ( 'users' ) . select ( ) . explain ( )
106
107
expect ( res ) . toMatchInlineSnapshot ( `
107
108
Object {
108
- "features": Array [
109
+ "count": undefined,
110
+ "data": Array [
109
111
Object {
110
- "geometry": Object {
111
- "coordinates": Array [
112
- -71.10044,
113
- 42.373695,
112
+ "Plan": Object {
113
+ "Async Capable": false,
114
+ "Node Type": "Aggregate",
115
+ "Parallel Aware": false,
116
+ "Partial Mode": "Simple",
117
+ "Plan Rows": 1,
118
+ "Plan Width": 112,
119
+ "Plans": Array [
120
+ Object {
121
+ "Alias": "users",
122
+ "Async Capable": false,
123
+ "Node Type": "Seq Scan",
124
+ "Parallel Aware": false,
125
+ "Parent Relationship": "Outer",
126
+ "Plan Rows": 510,
127
+ "Plan Width": 132,
128
+ "Relation Name": "users",
129
+ "Startup Cost": 0,
130
+ "Total Cost": 15.1,
131
+ },
114
132
],
115
- "type": "Point",
133
+ "Startup Cost": 17.65,
134
+ "Strategy": "Plain",
135
+ "Total Cost": 17.68,
116
136
},
117
- "properties": Object {
118
- "address": "1369 Cambridge St",
119
- "id": 1,
120
- },
121
- "type": "Feature",
122
137
},
123
138
],
124
- "type": "FeatureCollection",
139
+ "error": undefined,
140
+ "status": 200,
141
+ "statusText": "OK",
125
142
}
126
143
` )
127
144
} )
128
145
129
- test ( 'explain' , async ( ) => {
130
- const res = await postgrest
131
- . from ( 'users' )
132
- . select ( )
133
- . explain ( )
134
- . then ( ( res ) => res . data )
135
- expect ( res ) . toMatchInlineSnapshot ( `
136
- Array [
137
- Object {
138
- "Plan": Object {
139
- "Node Type": "Aggregate",
140
- "Parallel Aware": false,
141
- "Partial Mode": "Simple",
142
- "Plan Rows": 1,
143
- "Plan Width": 112,
144
- "Plans": Array [
145
- Object {
146
- "Alias": "users",
147
- "Node Type": "Seq Scan",
148
- "Parallel Aware": false,
149
- "Parent Relationship": "Outer",
150
- "Plan Rows": 510,
151
- "Plan Width": 132,
152
- "Relation Name": "users",
153
- "Startup Cost": 0,
154
- "Total Cost": 15.1,
155
- },
156
- ],
157
- "Startup Cost": 17.65,
158
- "Strategy": "Plain",
159
- "Total Cost": 17.68,
160
- },
161
- },
162
- ]
163
- ` )
164
- } )
165
-
166
146
test ( 'explain with options' , async ( ) => {
167
- const res = await postgrest
168
- . from ( 'users' )
169
- . select ( )
170
- . explain ( { verbose : true , settings : true } )
171
- . then ( ( res ) => res . data )
147
+ const res = await postgrest . from ( 'users' ) . select ( ) . explain ( { verbose : true , settings : true } )
172
148
expect ( res ) . toMatchInlineSnapshot ( `
173
- Array [
174
- Object {
175
- "Plan": Object {
176
- "Node Type": "Aggregate",
177
- "Output": Array [
178
- "NULL::bigint",
179
- "count(ROW(users.username, users.data, users.age_range, users.status, users.catchphrase))",
180
- "(COALESCE(json_agg(ROW(users.username, users.data, users.age_range, users.status, users.catchphrase)), '[]'::json))::character varying",
181
- "NULLIF(current_setting('response.headers'::text, true), ''::text)",
182
- "NULLIF(current_setting('response.status'::text, true), ''::text)",
183
- ],
184
- "Parallel Aware": false,
185
- "Partial Mode": "Simple",
186
- "Plan Rows": 1,
187
- "Plan Width": 112,
188
- "Plans": Array [
189
- Object {
190
- "Alias": "users",
191
- "Node Type": "Seq Scan",
192
- "Output": Array [
193
- "users.username",
194
- "users.data",
195
- "users.age_range",
196
- "users.status",
197
- "users.catchphrase",
198
- ],
199
- "Parallel Aware": false,
200
- "Parent Relationship": "Outer",
201
- "Plan Rows": 510,
202
- "Plan Width": 132,
203
- "Relation Name": "users",
204
- "Schema": "public",
205
- "Startup Cost": 0,
206
- "Total Cost": 15.1,
207
- },
208
- ],
209
- "Startup Cost": 17.65,
210
- "Strategy": "Plain",
211
- "Total Cost": 17.68,
212
- },
213
- "Settings": Object {
214
- "search_path": "\\\"public\\\", \\\"public\\\"",
149
+ Object {
150
+ "count": undefined,
151
+ "data": Array [
152
+ Object {
153
+ "Plan": Object {
154
+ "Async Capable": false,
155
+ "Node Type": "Aggregate",
156
+ "Output": Array [
157
+ "NULL::bigint",
158
+ "count(ROW(users.username, users.data, users.age_range, users.status, users.catchphrase))",
159
+ "(COALESCE(json_agg(ROW(users.username, users.data, users.age_range, users.status, users.catchphrase)), '[]'::json))::character varying",
160
+ "NULLIF(current_setting('response.headers'::text, true), ''::text)",
161
+ "NULLIF(current_setting('response.status'::text, true), ''::text)",
162
+ ],
163
+ "Parallel Aware": false,
164
+ "Partial Mode": "Simple",
165
+ "Plan Rows": 1,
166
+ "Plan Width": 112,
167
+ "Plans": Array [
168
+ Object {
169
+ "Alias": "users",
170
+ "Async Capable": false,
171
+ "Node Type": "Seq Scan",
172
+ "Output": Array [
173
+ "users.username",
174
+ "users.data",
175
+ "users.age_range",
176
+ "users.status",
177
+ "users.catchphrase",
178
+ ],
179
+ "Parallel Aware": false,
180
+ "Parent Relationship": "Outer",
181
+ "Plan Rows": 510,
182
+ "Plan Width": 132,
183
+ "Relation Name": "users",
184
+ "Schema": "public",
185
+ "Startup Cost": 0,
186
+ "Total Cost": 15.1,
187
+ },
188
+ ],
189
+ "Startup Cost": 17.65,
190
+ "Strategy": "Plain",
191
+ "Total Cost": 17.68,
192
+ },
193
+ "Query Identifier": -8888327821402777000,
194
+ "Settings": Object {
195
+ "effective_cache_size": "128MB",
196
+ "search_path": "\\"public\\", \\"extensions\\"",
197
+ },
215
198
},
216
- },
217
- ]
199
+ ],
200
+ "error": undefined,
201
+ "status": 200,
202
+ "statusText": "OK",
203
+ }
218
204
` )
219
205
} )
0 commit comments