@malloydata/malloy-tests 0.0.240-dev250311155207 → 0.0.240-dev250311202829

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -21,14 +21,14 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@jest/globals": "^29.4.3",
24
- "@malloydata/db-bigquery": "^0.0.240-dev250311155207",
25
- "@malloydata/db-duckdb": "^0.0.240-dev250311155207",
26
- "@malloydata/db-postgres": "^0.0.240-dev250311155207",
27
- "@malloydata/db-snowflake": "^0.0.240-dev250311155207",
28
- "@malloydata/db-trino": "^0.0.240-dev250311155207",
29
- "@malloydata/malloy": "^0.0.240-dev250311155207",
30
- "@malloydata/malloy-tag": "^0.0.240-dev250311155207",
31
- "@malloydata/render": "^0.0.240-dev250311155207",
24
+ "@malloydata/db-bigquery": "^0.0.240-dev250311202829",
25
+ "@malloydata/db-duckdb": "^0.0.240-dev250311202829",
26
+ "@malloydata/db-postgres": "^0.0.240-dev250311202829",
27
+ "@malloydata/db-snowflake": "^0.0.240-dev250311202829",
28
+ "@malloydata/db-trino": "^0.0.240-dev250311202829",
29
+ "@malloydata/malloy": "^0.0.240-dev250311202829",
30
+ "@malloydata/malloy-tag": "^0.0.240-dev250311202829",
31
+ "@malloydata/render": "^0.0.240-dev250311202829",
32
32
  "events": "^3.3.0",
33
33
  "jsdom": "^22.1.0",
34
34
  "luxon": "^2.4.0",
@@ -38,5 +38,5 @@
38
38
  "@types/jsdom": "^21.1.1",
39
39
  "@types/luxon": "^2.4.0"
40
40
  },
41
- "version": "0.0.240-dev250311155207"
41
+ "version": "0.0.240-dev250311202829"
42
42
  }
@@ -1,11 +1,524 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`rendering results bar chart renderer date with timezone rendered correctly 1`] = `
4
- <span
5
- class="error"
6
- >
7
- Cannot read properties of undefined (reading 'isAtomicField')
8
- </span>
4
+ <div>
5
+ <svg
6
+ class="marks"
7
+ height="548"
8
+ version="1.1"
9
+ viewBox="0 0 567 548"
10
+ width="567"
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ xmlns:xlink="http://www.w3.org/1999/xlink"
13
+ >
14
+ <g
15
+ fill="none"
16
+ stroke-miterlimit="10"
17
+ transform="translate(62,10)"
18
+ >
19
+ <g
20
+ aria-roledescription="group mark container"
21
+ class="mark-group role-frame root"
22
+ role="graphics-object"
23
+ >
24
+ <g
25
+ transform="translate(0,0)"
26
+ >
27
+ <path
28
+ aria-hidden="true"
29
+ class="background"
30
+ d="M0.5,0.5h500v350h-500Z"
31
+ stroke="#888"
32
+ />
33
+ <g>
34
+ <g
35
+ aria-hidden="true"
36
+ class="mark-group role-axis"
37
+ >
38
+ <g
39
+ transform="translate(0.5,0.5)"
40
+ >
41
+ <path
42
+ aria-hidden="true"
43
+ class="background"
44
+ d="M0,0h0v0h0Z"
45
+ pointer-events="none"
46
+ />
47
+ <g>
48
+ <g
49
+ class="mark-rule role-axis-grid"
50
+ pointer-events="none"
51
+ >
52
+ <line
53
+ opacity="1"
54
+ stroke="#E5E7EB"
55
+ stroke-width="1"
56
+ transform="translate(0,350)"
57
+ x2="500"
58
+ y2="0"
59
+ />
60
+ <line
61
+ opacity="1"
62
+ stroke="#E5E7EB"
63
+ stroke-width="1"
64
+ transform="translate(0,315)"
65
+ x2="500"
66
+ y2="0"
67
+ />
68
+ <line
69
+ opacity="1"
70
+ stroke="#E5E7EB"
71
+ stroke-width="1"
72
+ transform="translate(0,280)"
73
+ x2="500"
74
+ y2="0"
75
+ />
76
+ <line
77
+ opacity="1"
78
+ stroke="#E5E7EB"
79
+ stroke-width="1"
80
+ transform="translate(0,245)"
81
+ x2="500"
82
+ y2="0"
83
+ />
84
+ <line
85
+ opacity="1"
86
+ stroke="#E5E7EB"
87
+ stroke-width="1"
88
+ transform="translate(0,210)"
89
+ x2="500"
90
+ y2="0"
91
+ />
92
+ <line
93
+ opacity="1"
94
+ stroke="#E5E7EB"
95
+ stroke-width="1"
96
+ transform="translate(0,175)"
97
+ x2="500"
98
+ y2="0"
99
+ />
100
+ <line
101
+ opacity="1"
102
+ stroke="#E5E7EB"
103
+ stroke-width="1"
104
+ transform="translate(0,140)"
105
+ x2="500"
106
+ y2="0"
107
+ />
108
+ <line
109
+ opacity="1"
110
+ stroke="#E5E7EB"
111
+ stroke-width="1"
112
+ transform="translate(0,105)"
113
+ x2="500"
114
+ y2="0"
115
+ />
116
+ <line
117
+ opacity="1"
118
+ stroke="#E5E7EB"
119
+ stroke-width="1"
120
+ transform="translate(0,70)"
121
+ x2="500"
122
+ y2="0"
123
+ />
124
+ <line
125
+ opacity="1"
126
+ stroke="#E5E7EB"
127
+ stroke-width="1"
128
+ transform="translate(0,35)"
129
+ x2="500"
130
+ y2="0"
131
+ />
132
+ <line
133
+ opacity="1"
134
+ stroke="#E5E7EB"
135
+ stroke-width="1"
136
+ transform="translate(0,0)"
137
+ x2="500"
138
+ y2="0"
139
+ />
140
+ </g>
141
+ </g>
142
+ <path
143
+ aria-hidden="true"
144
+ class="foreground"
145
+ d=""
146
+ display="none"
147
+ pointer-events="none"
148
+ />
149
+ </g>
150
+ </g>
151
+ <g
152
+ aria-label="X-axis titled 'mex_time (America/Mexico_City)' for a discrete scale with 1 value: 2021-02-24 03:05:06"
153
+ aria-roledescription="axis"
154
+ class="mark-group role-axis"
155
+ role="graphics-symbol"
156
+ >
157
+ <g
158
+ transform="translate(0.5,350.5)"
159
+ >
160
+ <path
161
+ aria-hidden="true"
162
+ class="background"
163
+ d="M0,0h0v0h0Z"
164
+ pointer-events="none"
165
+ />
166
+ <g>
167
+ <g
168
+ class="mark-rule role-axis-tick"
169
+ pointer-events="none"
170
+ >
171
+ <line
172
+ opacity="1"
173
+ stroke="#E5E7EB"
174
+ stroke-width="1"
175
+ transform="translate(250,0)"
176
+ x2="0"
177
+ y2="5"
178
+ />
179
+ </g>
180
+ <g
181
+ class="mark-text role-axis-label"
182
+ pointer-events="none"
183
+ >
184
+ <text
185
+ fill="var(--malloy-label-color, #727883)"
186
+ font-family="var(--malloy-font-family, 'Inter')"
187
+ font-size="10px"
188
+ opacity="1"
189
+ text-anchor="end"
190
+ transform="translate(249.5,10) rotate(270) translate(0,3)"
191
+ >
192
+ 2021-02-24 03:05:06
193
+ </text>
194
+ </g>
195
+ <g
196
+ class="mark-rule role-axis-domain"
197
+ pointer-events="none"
198
+ >
199
+ <line
200
+ opacity="1"
201
+ stroke="#ddd"
202
+ stroke-width="1"
203
+ transform="translate(0,0)"
204
+ x2="500"
205
+ y2="0"
206
+ />
207
+ </g>
208
+ <g
209
+ class="mark-text role-axis-title"
210
+ pointer-events="none"
211
+ >
212
+ <text
213
+ fill="var(--malloy-title-color, #727883)"
214
+ font-family="var(--malloy-font-family, 'Inter')"
215
+ font-size="12px"
216
+ font-weight="500"
217
+ opacity="1"
218
+ text-anchor="middle"
219
+ transform="translate(250,181)"
220
+ >
221
+ mex_time (America/Mexico_City)
222
+ </text>
223
+ </g>
224
+ </g>
225
+ <path
226
+ aria-hidden="true"
227
+ class="foreground"
228
+ d=""
229
+ display="none"
230
+ pointer-events="none"
231
+ />
232
+ </g>
233
+ </g>
234
+ <g
235
+ aria-label="Y-axis titled 'value' for a linear scale with values from 0.0 to 1.0"
236
+ aria-roledescription="axis"
237
+ class="mark-group role-axis"
238
+ role="graphics-symbol"
239
+ >
240
+ <g
241
+ transform="translate(0.5,0.5)"
242
+ >
243
+ <path
244
+ aria-hidden="true"
245
+ class="background"
246
+ d="M0,0h0v0h0Z"
247
+ pointer-events="none"
248
+ />
249
+ <g>
250
+ <g
251
+ class="mark-rule role-axis-tick"
252
+ pointer-events="none"
253
+ >
254
+ <line
255
+ opacity="1"
256
+ stroke="#E5E7EB"
257
+ stroke-width="1"
258
+ transform="translate(0,350)"
259
+ x2="-5"
260
+ y2="0"
261
+ />
262
+ <line
263
+ opacity="1"
264
+ stroke="#E5E7EB"
265
+ stroke-width="1"
266
+ transform="translate(0,315)"
267
+ x2="-5"
268
+ y2="0"
269
+ />
270
+ <line
271
+ opacity="1"
272
+ stroke="#E5E7EB"
273
+ stroke-width="1"
274
+ transform="translate(0,280)"
275
+ x2="-5"
276
+ y2="0"
277
+ />
278
+ <line
279
+ opacity="1"
280
+ stroke="#E5E7EB"
281
+ stroke-width="1"
282
+ transform="translate(0,245)"
283
+ x2="-5"
284
+ y2="0"
285
+ />
286
+ <line
287
+ opacity="1"
288
+ stroke="#E5E7EB"
289
+ stroke-width="1"
290
+ transform="translate(0,210)"
291
+ x2="-5"
292
+ y2="0"
293
+ />
294
+ <line
295
+ opacity="1"
296
+ stroke="#E5E7EB"
297
+ stroke-width="1"
298
+ transform="translate(0,175)"
299
+ x2="-5"
300
+ y2="0"
301
+ />
302
+ <line
303
+ opacity="1"
304
+ stroke="#E5E7EB"
305
+ stroke-width="1"
306
+ transform="translate(0,140)"
307
+ x2="-5"
308
+ y2="0"
309
+ />
310
+ <line
311
+ opacity="1"
312
+ stroke="#E5E7EB"
313
+ stroke-width="1"
314
+ transform="translate(0,105)"
315
+ x2="-5"
316
+ y2="0"
317
+ />
318
+ <line
319
+ opacity="1"
320
+ stroke="#E5E7EB"
321
+ stroke-width="1"
322
+ transform="translate(0,70)"
323
+ x2="-5"
324
+ y2="0"
325
+ />
326
+ <line
327
+ opacity="1"
328
+ stroke="#E5E7EB"
329
+ stroke-width="1"
330
+ transform="translate(0,35)"
331
+ x2="-5"
332
+ y2="0"
333
+ />
334
+ <line
335
+ opacity="1"
336
+ stroke="#E5E7EB"
337
+ stroke-width="1"
338
+ transform="translate(0,0)"
339
+ x2="-5"
340
+ y2="0"
341
+ />
342
+ </g>
343
+ <g
344
+ class="mark-text role-axis-label"
345
+ pointer-events="none"
346
+ >
347
+ <text
348
+ fill="var(--malloy-label-color, #727883)"
349
+ font-family="var(--malloy-font-family, 'Inter')"
350
+ font-size="10px"
351
+ opacity="1"
352
+ text-anchor="end"
353
+ transform="translate(-10,353)"
354
+ >
355
+ 0.0
356
+ </text>
357
+ <text
358
+ fill="var(--malloy-label-color, #727883)"
359
+ font-family="var(--malloy-font-family, 'Inter')"
360
+ font-size="10px"
361
+ opacity="1"
362
+ text-anchor="end"
363
+ transform="translate(-10,318)"
364
+ >
365
+ 0.1
366
+ </text>
367
+ <text
368
+ fill="var(--malloy-label-color, #727883)"
369
+ font-family="var(--malloy-font-family, 'Inter')"
370
+ font-size="10px"
371
+ opacity="1"
372
+ text-anchor="end"
373
+ transform="translate(-10,283)"
374
+ >
375
+ 0.2
376
+ </text>
377
+ <text
378
+ fill="var(--malloy-label-color, #727883)"
379
+ font-family="var(--malloy-font-family, 'Inter')"
380
+ font-size="10px"
381
+ opacity="1"
382
+ text-anchor="end"
383
+ transform="translate(-10,247.99999999999997)"
384
+ >
385
+ 0.3
386
+ </text>
387
+ <text
388
+ fill="var(--malloy-label-color, #727883)"
389
+ font-family="var(--malloy-font-family, 'Inter')"
390
+ font-size="10px"
391
+ opacity="1"
392
+ text-anchor="end"
393
+ transform="translate(-10,213)"
394
+ >
395
+ 0.4
396
+ </text>
397
+ <text
398
+ fill="var(--malloy-label-color, #727883)"
399
+ font-family="var(--malloy-font-family, 'Inter')"
400
+ font-size="10px"
401
+ opacity="1"
402
+ text-anchor="end"
403
+ transform="translate(-10,178)"
404
+ >
405
+ 0.5
406
+ </text>
407
+ <text
408
+ fill="var(--malloy-label-color, #727883)"
409
+ font-family="var(--malloy-font-family, 'Inter')"
410
+ font-size="10px"
411
+ opacity="1"
412
+ text-anchor="end"
413
+ transform="translate(-10,143)"
414
+ >
415
+ 0.6
416
+ </text>
417
+ <text
418
+ fill="var(--malloy-label-color, #727883)"
419
+ font-family="var(--malloy-font-family, 'Inter')"
420
+ font-size="10px"
421
+ opacity="1"
422
+ text-anchor="end"
423
+ transform="translate(-10,108.00000000000001)"
424
+ >
425
+ 0.7
426
+ </text>
427
+ <text
428
+ fill="var(--malloy-label-color, #727883)"
429
+ font-family="var(--malloy-font-family, 'Inter')"
430
+ font-size="10px"
431
+ opacity="1"
432
+ text-anchor="end"
433
+ transform="translate(-10,72.99999999999999)"
434
+ >
435
+ 0.8
436
+ </text>
437
+ <text
438
+ fill="var(--malloy-label-color, #727883)"
439
+ font-family="var(--malloy-font-family, 'Inter')"
440
+ font-size="10px"
441
+ opacity="1"
442
+ text-anchor="end"
443
+ transform="translate(-10,37.99999999999999)"
444
+ >
445
+ 0.9
446
+ </text>
447
+ <text
448
+ fill="var(--malloy-label-color, #727883)"
449
+ font-family="var(--malloy-font-family, 'Inter')"
450
+ font-size="10px"
451
+ opacity="1"
452
+ text-anchor="end"
453
+ transform="translate(-10,3)"
454
+ >
455
+ 1.0
456
+ </text>
457
+ </g>
458
+ <g
459
+ class="mark-rule role-axis-domain"
460
+ pointer-events="none"
461
+ >
462
+ <line
463
+ opacity="1"
464
+ stroke="#ddd"
465
+ stroke-width="1"
466
+ transform="translate(0,350)"
467
+ x2="0"
468
+ y2="-350"
469
+ />
470
+ </g>
471
+ <g
472
+ class="mark-text role-axis-title"
473
+ pointer-events="none"
474
+ >
475
+ <text
476
+ fill="var(--malloy-title-color, #727883)"
477
+ font-family="var(--malloy-font-family, 'Inter')"
478
+ font-size="12px"
479
+ font-weight="500"
480
+ opacity="1"
481
+ text-anchor="middle"
482
+ transform="translate(-44,175) rotate(-90) translate(0,-3)"
483
+ >
484
+ value
485
+ </text>
486
+ </g>
487
+ </g>
488
+ <path
489
+ aria-hidden="true"
490
+ class="foreground"
491
+ d=""
492
+ display="none"
493
+ pointer-events="none"
494
+ />
495
+ </g>
496
+ </g>
497
+ <g
498
+ aria-roledescription="rect mark container"
499
+ class="mark-rect role-mark marks"
500
+ role="graphics-object"
501
+ >
502
+ <path
503
+ aria-label="mex_time: 2021-02-24 03:05:06; value: 1"
504
+ aria-roledescription="bar"
505
+ d="M25,0h450v350h-450Z"
506
+ fill="#4285F4"
507
+ role="graphics-symbol"
508
+ />
509
+ </g>
510
+ </g>
511
+ <path
512
+ aria-hidden="true"
513
+ class="foreground"
514
+ d=""
515
+ display="none"
516
+ />
517
+ </g>
518
+ </g>
519
+ </g>
520
+ </svg>
521
+ </div>
9
522
  `;
10
523
 
11
524
  exports[`rendering results data volume renderer data volume tags works correctly 1`] = `
@@ -1,28 +1,13 @@
1
1
  /*
2
- * Copyright 2023 Google LLC
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
- * Permission is hereby granted, free of charge, to any person obtaining
5
- * a copy of this software and associated documentation files
6
- * (the "Software"), to deal in the Software without restriction,
7
- * including without limitation the rights to use, copy, modify, merge,
8
- * publish, distribute, sublicense, and/or sell copies of the Software,
9
- * and to permit persons to whom the Software is furnished to do so,
10
- * subject to the following conditions:
11
- *
12
- * The above copyright notice and this permission notice shall be
13
- * included in all copies or substantial portions of the Software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
22
6
  */
23
7
 
24
8
  import {runtimeFor} from '../runtimes';
25
- import {getDrillQuery} from '@malloydata/render';
9
+ import {getDataTree} from '@malloydata/render';
10
+ import {API} from '@malloydata/malloy';
26
11
 
27
12
  const duckdb = runtimeFor('duckdb');
28
13
 
@@ -61,11 +46,17 @@ describe('drill query', () => {
61
46
  view: no_filter is {
62
47
  aggregate: flight_count
63
48
  }
49
+
50
+ view: cool_carriers is {
51
+ where: carrier = 'AA' or carrier = 'WN'
52
+ group_by: \`Origin Code\`
53
+ }
64
54
  }
65
55
  query: top_carriers is flights -> top_carriers
66
56
  query: over_time is flights -> over_time
67
57
  query: by_origin is flights -> by_origin
68
58
  query: no_filter is flights -> no_filter
59
+ query: cool_carriers is flights -> cool_carriers
69
60
  `;
70
61
 
71
62
  beforeEach(() => {
@@ -73,46 +64,70 @@ describe('drill query', () => {
73
64
  });
74
65
 
75
66
  test('can handle joined-in table fields', async () => {
76
- const result = duckdb
67
+ const result = await duckdb
77
68
  .loadModel(model)
78
69
  .loadQueryByName('top_carriers')
79
70
  .run();
80
- const table = (await result).data;
71
+ const table = getDataTree(API.util.wrapResult(result));
81
72
  const expDrillQuery =
82
- 'run: flights -> { \n' +
83
- ' where: \n' +
84
- " carriers.nickname = 'Southwest'" +
85
- ' \n' +
86
- '} + {select: *}\n';
87
- const row = table.row(0);
88
- expect(getDrillQuery(row).drillQuery).toEqual(expDrillQuery);
73
+ 'run: flights -> {\n' +
74
+ ' where:\n' +
75
+ " carriers.nickname = 'Southwest'\n" +
76
+ '} + { select: * }';
77
+ const row = table.rows[0];
78
+ expect(row.getDrillQuery()).toEqual(expDrillQuery);
89
79
  });
90
80
 
91
81
  test('can handle expression fields', async () => {
92
- const result = duckdb.loadModel(model).loadQueryByName('over_time').run();
93
- const table = (await result).data;
82
+ const result = await duckdb
83
+ .loadModel(model)
84
+ .loadQueryByName('over_time')
85
+ .run();
86
+ const table = getDataTree(API.util.wrapResult(result));
94
87
  const expDrillQuery =
95
- 'run: flights -> { \n where: \n ' +
96
- 'month(dep_time) = 8 \n} + {select: *}\n';
97
- const row = table.row(0);
98
- expect(getDrillQuery(row).drillQuery).toEqual(expDrillQuery);
88
+ 'run: flights -> {\n where:\n ' +
89
+ 'month(dep_time) = 8\n} + { select: * }';
90
+ const row = table.rows[0];
91
+ expect(row.getDrillQuery()).toEqual(expDrillQuery);
99
92
  });
100
93
 
101
94
  test('can handle renamed and multi-word field names', async () => {
102
- const result = duckdb.loadModel(model).loadQueryByName('by_origin').run();
103
- const table = (await result).data;
95
+ const result = await duckdb
96
+ .loadModel(model)
97
+ .loadQueryByName('by_origin')
98
+ .run();
99
+ const table = getDataTree(API.util.wrapResult(result));
104
100
  const expDrillQuery =
105
- 'run: flights -> { \n where: \n ' +
106
- "`Origin Code` = 'ATL' \n} + {select: *}\n";
107
- const row = table.row(0);
108
- expect(getDrillQuery(row).drillQuery).toEqual(expDrillQuery);
101
+ 'run: flights -> {\n where:\n ' +
102
+ "`Origin Code` = 'ATL'\n} + { select: * }";
103
+ const row = table.rows[0];
104
+ expect(row.getDrillQuery()).toEqual(expDrillQuery);
109
105
  });
110
106
 
111
107
  test('can handle queries with no filter', async () => {
112
- const result = duckdb.loadModel(model).loadQueryByName('no_filter').run();
113
- const table = (await result).data;
114
- const expDrillQuery = 'run: flights -> {select: *}';
115
- const row = table.row(0);
116
- expect(getDrillQuery(row).drillQuery).toEqual(expDrillQuery);
108
+ const result = await duckdb
109
+ .loadModel(model)
110
+ .loadQueryByName('no_filter')
111
+ .run();
112
+ const table = getDataTree(API.util.wrapResult(result));
113
+ const expDrillQuery = 'run: flights -> { select: * }';
114
+ const row = table.rows[0];
115
+ expect(row.getDrillQuery()).toEqual(expDrillQuery);
116
+ });
117
+
118
+ test('can handle view filters', async () => {
119
+ const result = await duckdb
120
+ .loadModel(model)
121
+ .loadQueryByName('cool_carriers')
122
+ .run();
123
+ const table = getDataTree(API.util.wrapResult(result));
124
+ const expDrillQuery =
125
+ 'run: flights -> {\n' +
126
+ ' where:\n' +
127
+ " carrier = 'AA' or carrier = 'WN',\n" +
128
+ " `Origin Code` = 'ABQ'\n" +
129
+ '} + { select: * }';
130
+ const row = table.rows[0];
131
+ expect(row.getDrillQuery()).toEqual(expDrillQuery);
117
132
  });
118
133
  });
@@ -24,8 +24,8 @@
24
24
  import {ModelMaterializer} from '@malloydata/malloy';
25
25
  import {RuntimeList, runtimeFor} from '../runtimes';
26
26
  import {describeIfDatabaseAvailable} from '../util';
27
- import {HTMLView} from '@malloydata/render';
28
27
  import {JSDOM} from 'jsdom';
28
+ import {HTMLView} from '@malloydata/render';
29
29
 
30
30
  async function runUnsupportedRenderTest(
31
31
  connectionName: string,
@@ -442,9 +442,10 @@ describe('rendering results', () => {
442
442
 
443
443
  query: by_name is height -> by_name
444
444
  `;
445
- const result = await (
446
- await duckdb.loadModel(src).loadQueryByName('by_name')
447
- ).run();
445
+ const result = await duckdb
446
+ .loadModel(src)
447
+ .loadQueryByName('by_name')
448
+ .run();
448
449
  const document = new JSDOM().window.document;
449
450
  const html = await new HTMLView(document).render(result, {
450
451
  dataStyles: {},
@@ -473,7 +474,6 @@ describe('rendering results', () => {
473
474
  UNION ALL SELECT 'Miguel', 'Wednesday', 1, 2, 3, 35, 4.2, 31, 1, 'E'
474
475
  UNION ALL SELECT 'Miguel', 'Wednesday', 1, 2, 4, 47, 4.3, 76, 0, 'F' """) extend {
475
476
 
476
-
477
477
  view: flatten is {
478
478
  group_by: nm
479
479
  aggregate: avg_height is height.avg()
@@ -494,9 +494,10 @@ describe('rendering results', () => {
494
494
 
495
495
  query: flatten is height -> flatten
496
496
  `;
497
- const result = await (
498
- await duckdb.loadModel(src).loadQueryByName('flatten')
499
- ).run();
497
+ const result = await duckdb
498
+ .loadModel(src)
499
+ .loadQueryByName('flatten')
500
+ .run();
500
501
  const document = new JSDOM().window.document;
501
502
  const html = await new HTMLView(document).render(result, {
502
503
  dataStyles: {},
@@ -514,9 +515,10 @@ describe('rendering results', () => {
514
515
  select: mex_time is @2021-02-24 03:05:06
515
516
  }
516
517
  `;
517
- const result = await (
518
- await duckdb.loadModel(src).loadQueryByName('mex_query')
519
- ).run();
518
+ const result = await duckdb
519
+ .loadModel(src)
520
+ .loadQueryByName('mex_query')
521
+ .run();
520
522
  const document = new JSDOM().window.document;
521
523
  const html = await new HTMLView(document).render(result, {
522
524
  dataStyles: {},
@@ -532,15 +534,15 @@ describe('rendering results', () => {
532
534
  UNION ALL SELECT CAST('2021-01-01 05:40:00' AS datetime)
533
535
  UNION ALL SELECT CAST('2021-04-01 00:59:00' AS datetime)""")
534
536
 
535
-
536
537
  query:
537
538
  data_trunc is timeDataTrunc -> {
538
539
  select: yr is times.year, qt is times.quarter, mt is times.month, dy is times.day
539
540
  }
540
541
  `;
541
- const result = await (
542
- await duckdb.loadModel(src).loadQueryByName('data_trunc')
543
- ).run();
542
+ const result = await duckdb
543
+ .loadModel(src)
544
+ .loadQueryByName('data_trunc')
545
+ .run();
544
546
  const document = new JSDOM().window.document;
545
547
  const html = await new HTMLView(document).render(result, {
546
548
  dataStyles: {},
@@ -556,12 +558,14 @@ describe('rendering results', () => {
556
558
  query: mex_query is # bar_chart
557
559
  duckdb.sql('SELECT 1 as one') -> {
558
560
  timezone: 'America/Mexico_City'
559
- select: mex_time is @2021-02-24 03:05:06
561
+ group_by: mex_time is @2021-02-24 03:05:06
562
+ aggregate: value is sum(1)
560
563
  }
561
564
  `;
562
- const result = await (
563
- await duckdb.loadModel(src).loadQueryByName('mex_query')
564
- ).run();
565
+ const result = await duckdb
566
+ .loadModel(src)
567
+ .loadQueryByName('mex_query')
568
+ .run();
565
569
  const document = new JSDOM().window.document;
566
570
  const html = await new HTMLView(document).render(result, {
567
571
  dataStyles: {},
@@ -583,9 +587,10 @@ describe('rendering results', () => {
583
587
  aggregate:
584
588
  sizeSum is sum(size)
585
589
  }`;
586
- const result = await (
587
- await duckdb.loadModel(src).loadQueryByName('mexico_point_map')
588
- ).run();
590
+ const result = await duckdb
591
+ .loadModel(src)
592
+ .loadQueryByName('mexico_point_map')
593
+ .run();
589
594
  const document = new JSDOM().window.document;
590
595
  const html = await new HTMLView(document).render(result, {
591
596
  dataStyles: {},
@@ -607,9 +612,10 @@ describe('rendering results', () => {
607
612
  shorter is anumber
608
613
  }
609
614
  `;
610
- const result = await (
611
- await duckdb.loadModel(src).loadQueryByName('number_query')
612
- ).run();
615
+ const result = await duckdb
616
+ .loadModel(src)
617
+ .loadQueryByName('number_query')
618
+ .run();
613
619
  const document = new JSDOM().window.document;
614
620
  const html = await new HTMLView(document).render(result, {
615
621
  dataStyles: {},
@@ -636,9 +642,10 @@ describe('rendering results', () => {
636
642
  usage_tb is 3758096384000
637
643
  }
638
644
  `;
639
- const result = await (
640
- await duckdb.loadModel(src).loadQueryByName('bytes_query')
641
- ).run();
645
+ const result = await duckdb
646
+ .loadModel(src)
647
+ .loadQueryByName('bytes_query')
648
+ .run();
642
649
  const document = new JSDOM().window.document;
643
650
  const html = await new HTMLView(document).render(result, {
644
651
  dataStyles: {},
@@ -664,9 +671,10 @@ describe('rendering results', () => {
664
671
  key is "4"
665
672
  }
666
673
  `;
667
- const result = await (
668
- await duckdb.loadModel(src).loadQueryByName('bytes_query')
669
- ).run();
674
+ const result = await duckdb
675
+ .loadModel(src)
676
+ .loadQueryByName('bytes_query')
677
+ .run();
670
678
  const document = new JSDOM().window.document;
671
679
  const html = await new HTMLView(document).render(result, {
672
680
  dataStyles: {},
@@ -727,9 +735,10 @@ describe('rendering results', () => {
727
735
  d2 is 300
728
736
  }
729
737
  `;
730
- const result = await (
731
- await duckdb.loadModel(src).loadQueryByName('duration_query')
732
- ).run();
738
+ const result = await duckdb
739
+ .loadModel(src)
740
+ .loadQueryByName('duration_query')
741
+ .run();
733
742
  const document = new JSDOM().window.document;
734
743
  const html = await new HTMLView(document).render(result, {
735
744
  dataStyles: {},
@@ -30,6 +30,7 @@ import {
30
30
  MalloyError,
31
31
  LogMessage,
32
32
  SingleConnectionRuntime,
33
+ API,
33
34
  } from '@malloydata/malloy';
34
35
  import {Tag} from '@malloydata/malloy-tag';
35
36
  import EventEmitter from 'events';
@@ -166,6 +167,16 @@ expect.extend({
166
167
  return {pass: false, message: () => failMsg};
167
168
  }
168
169
 
170
+ try {
171
+ API.util.wrapResult(result);
172
+ } catch (error) {
173
+ return {
174
+ pass: false,
175
+ message: () =>
176
+ `Result could not be wrapped into new style result: ${error}\n${error.stack}`,
177
+ };
178
+ }
179
+
169
180
  const allRows = Array.isArray(shouldEqual) ? shouldEqual : [shouldEqual];
170
181
  const fails: string[] = [];
171
182
  const gotRows = result.data.toObject().length;
package/tsconfig.json CHANGED
@@ -2,7 +2,9 @@
2
2
  "extends": "../tsconfig.packages.json",
3
3
  "compilerOptions": {
4
4
  "noEmit": true,
5
- "composite": true
5
+ "composite": true,
6
+ "jsx": "react-jsx",
7
+ "jsxImportSource": "solid-js",
6
8
  },
7
9
  "include": ["src", "bin", "./jest.setup.ts", "./types/jest.d.ts"],
8
10
  "references": [