@malloydata/malloy-tests 0.0.127-dev240306172007 → 0.0.127-dev240308180053
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/dist/databases/all/db_index.spec.js +2 -2
- package/dist/databases/all/db_index.spec.js.map +1 -1
- package/dist/databases/all/expr.spec.js +14 -14
- package/dist/databases/all/expr.spec.js.map +1 -1
- package/dist/databases/all/join.spec.js +2 -2
- package/dist/databases/all/join.spec.js.map +1 -1
- package/dist/databases/all/nomodel.spec.js +34 -34
- package/dist/databases/all/nomodel.spec.js.map +1 -1
- package/dist/databases/all/orderby.spec.js +4 -4
- package/dist/databases/all/orderby.spec.js.map +1 -1
- package/dist/databases/all/time.spec.js +22 -22
- package/dist/databases/all/time.spec.js.map +1 -1
- package/dist/databases/bigquery-postgres/multi_connection.spec.js +4 -7
- package/dist/databases/bigquery-postgres/multi_connection.spec.js.map +1 -1
- package/dist/databases/bigquery-postgres/streaming.spec.js +3 -0
- package/dist/databases/bigquery-postgres/streaming.spec.js.map +1 -1
- package/dist/databases/duckdb/duckdb.spec.js +1 -1
- package/dist/databases/duckdb/duckdb.spec.js.map +1 -1
- package/dist/databases/duckdb/streaming.spec.js +3 -0
- package/dist/databases/duckdb/streaming.spec.js.map +1 -1
- package/dist/render/render.spec.js +28 -28
- package/dist/render/render.spec.js.map +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.js +17 -6
- package/dist/util/index.js.map +1 -1
- package/package.json +10 -7
- package/src/databases/all/db_index.spec.ts +4 -4
- package/src/databases/all/expr.spec.ts +41 -29
- package/src/databases/all/join.spec.ts +4 -4
- package/src/databases/all/nomodel.spec.ts +66 -60
- package/src/databases/all/orderby.spec.ts +7 -7
- package/src/databases/all/time.spec.ts +40 -37
- package/src/databases/bigquery-postgres/multi_connection.spec.ts +4 -6
- package/src/databases/bigquery-postgres/streaming.spec.ts +3 -0
- package/src/databases/duckdb/duckdb.spec.ts +1 -1
- package/src/databases/duckdb/streaming.spec.ts +3 -0
- package/src/render/render.spec.ts +162 -120
- package/src/util/index.ts +24 -4
|
@@ -29,16 +29,14 @@ import {EmptyURLReader} from '@malloydata/malloy';
|
|
|
29
29
|
import {BigQueryTestConnection, PostgresTestConnection} from '../../runtimes';
|
|
30
30
|
import {describeIfDatabaseAvailable} from '../../util';
|
|
31
31
|
|
|
32
|
-
const
|
|
33
|
-
let [describe] = res;
|
|
34
|
-
const [, databases] = res;
|
|
32
|
+
const [, databases] = describeIfDatabaseAvailable(['bigquery', 'postgres']);
|
|
35
33
|
|
|
36
34
|
// *** NOTE ***
|
|
37
35
|
// this is a special case (for now): a test that REQUIRES two databases - bigquery AND postgres
|
|
38
|
-
describe =
|
|
36
|
+
const describe =
|
|
39
37
|
databases.filter(d => ['postgres', 'bigquery'].includes(d)).length >= 2
|
|
40
|
-
? describe
|
|
41
|
-
: describe.skip;
|
|
38
|
+
? globalThis.describe
|
|
39
|
+
: globalThis.describe.skip;
|
|
42
40
|
|
|
43
41
|
describe('Multi-connection', () => {
|
|
44
42
|
const bqConnection = new BigQueryTestConnection(
|
|
@@ -29,7 +29,7 @@ import {describeIfDatabaseAvailable} from '../../util';
|
|
|
29
29
|
// TODO identify which tests need to run on wasm and move them into their own file
|
|
30
30
|
const runtimes = ['duckdb', 'duckdb_wasm'];
|
|
31
31
|
|
|
32
|
-
const [
|
|
32
|
+
const [describe, databases] = describeIfDatabaseAvailable(runtimes);
|
|
33
33
|
const allDucks = new RuntimeList(databases);
|
|
34
34
|
|
|
35
35
|
describe.each(allDucks.runtimeList)('duckdb:%s', (dbName, runtime) => {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
import {ModelMaterializer} from '@malloydata/malloy';
|
|
25
25
|
import {RuntimeList, runtimeFor} from '../runtimes';
|
|
26
|
-
import {describeIfDatabaseAvailable} from '../util';
|
|
26
|
+
import {describeIfDatabaseAvailable, onlyIf} from '../util';
|
|
27
27
|
import {HTMLView} from '@malloydata/render';
|
|
28
28
|
import {JSDOM} from 'jsdom';
|
|
29
29
|
|
|
@@ -66,130 +66,172 @@ describe('rendering results', () => {
|
|
|
66
66
|
await runtimes.closeAll();
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
test(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
test(
|
|
70
|
+
'can render table',
|
|
71
|
+
onlyIf(databases.includes('bigquery'), async () => {
|
|
72
|
+
const runtime = runtimes.runtimeMap.get('bigquery');
|
|
73
|
+
expect(runtime).toBeDefined();
|
|
74
|
+
if (runtime) {
|
|
75
|
+
const src = `
|
|
74
76
|
run: bigquery.table('malloy-data.faa.flights') -> {
|
|
75
77
|
group_by: carrier
|
|
76
78
|
aggregate: flight_count is count()
|
|
77
79
|
}
|
|
78
80
|
`;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
'
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
81
|
+
const result = await runtime.loadQuery(src).run();
|
|
82
|
+
const document = new JSDOM().window.document;
|
|
83
|
+
await new HTMLView(document).render(result, {
|
|
84
|
+
dataStyles: {},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
test(
|
|
91
|
+
'can render unsupported bigquery geo types',
|
|
92
|
+
onlyIf(databases.includes('bigquery'), async () => {
|
|
93
|
+
await runUnsupportedRenderTest(
|
|
94
|
+
'bigquery',
|
|
95
|
+
runtimes,
|
|
96
|
+
"ST_GEOGFROMTEXT('LINESTRING(1 2, 3 4)')",
|
|
97
|
+
'LINESTRING(1 2, 3 4)'
|
|
98
|
+
);
|
|
99
|
+
})
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
test(
|
|
103
|
+
'can render unsupported bigquery ip types',
|
|
104
|
+
onlyIf(databases.includes('bigquery'), async () => {
|
|
105
|
+
await runUnsupportedRenderTest(
|
|
106
|
+
'bigquery',
|
|
107
|
+
runtimes,
|
|
108
|
+
"NET.IP_FROM_STRING('192.168.1.1')",
|
|
109
|
+
'{"type":"Buffer","data":[192,168,1,1]}'
|
|
110
|
+
);
|
|
111
|
+
})
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
test(
|
|
115
|
+
'can render unsupported bigquery interval types',
|
|
116
|
+
onlyIf(databases.includes('bigquery'), async () => {
|
|
117
|
+
await runUnsupportedRenderTest(
|
|
118
|
+
'bigquery',
|
|
119
|
+
runtimes,
|
|
120
|
+
'INTERVAL 1 YEAR',
|
|
121
|
+
'1-0 0 0:0:0'
|
|
122
|
+
);
|
|
123
|
+
})
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
test(
|
|
127
|
+
'can render unsupported bigquery time types',
|
|
128
|
+
onlyIf(databases.includes('bigquery'), async () => {
|
|
129
|
+
await runUnsupportedRenderTest(
|
|
130
|
+
'bigquery',
|
|
131
|
+
runtimes,
|
|
132
|
+
'TIME(10, 10, 1)',
|
|
133
|
+
'10:10:01'
|
|
134
|
+
);
|
|
135
|
+
})
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
test(
|
|
139
|
+
'can render unsupported postgres interval types',
|
|
140
|
+
onlyIf(databases.includes('postgres'), async () => {
|
|
141
|
+
await runUnsupportedRenderTest(
|
|
142
|
+
'postgres',
|
|
143
|
+
runtimes,
|
|
144
|
+
'make_interval(days => 12)',
|
|
145
|
+
'12 days'
|
|
146
|
+
);
|
|
147
|
+
})
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
test(
|
|
151
|
+
'can render unsupported postgres uuid types',
|
|
152
|
+
onlyIf(databases.includes('postgres'), async () => {
|
|
153
|
+
await runUnsupportedRenderTest(
|
|
154
|
+
'postgres',
|
|
155
|
+
runtimes,
|
|
156
|
+
"CAST('a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11' AS UUID)",
|
|
157
|
+
'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
|
|
158
|
+
);
|
|
159
|
+
})
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
test(
|
|
163
|
+
'can render unsupported postgres inet types',
|
|
164
|
+
onlyIf(databases.includes('postgres'), async () => {
|
|
165
|
+
await runUnsupportedRenderTest(
|
|
166
|
+
'postgres',
|
|
167
|
+
runtimes,
|
|
168
|
+
"'192.168.1.1'::inet",
|
|
169
|
+
'192.168.1.1'
|
|
170
|
+
);
|
|
171
|
+
})
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
test(
|
|
175
|
+
'can render unsupported postgres macaddr types',
|
|
176
|
+
onlyIf(databases.includes('postgres'), async () => {
|
|
177
|
+
await runUnsupportedRenderTest(
|
|
178
|
+
'postgres',
|
|
179
|
+
runtimes,
|
|
180
|
+
"'00:04:E2:36:95:C0'::macaddr",
|
|
181
|
+
'00:04:e2:36:95:c0'
|
|
182
|
+
);
|
|
183
|
+
})
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
test(
|
|
187
|
+
'can render supported postgres types',
|
|
188
|
+
onlyIf(databases.includes('postgres'), async () => {
|
|
189
|
+
await runUnsupportedRenderTest('postgres', runtimes, '12345', '12,345');
|
|
190
|
+
})
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
test(
|
|
194
|
+
'can render supported duckdb types',
|
|
195
|
+
onlyIf(databases.includes('duckdb'), async () => {
|
|
196
|
+
await runUnsupportedRenderTest('duckdb', runtimes, '12345', '12,345');
|
|
197
|
+
})
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
test(
|
|
201
|
+
'can render unsupported duckdb blob types',
|
|
202
|
+
onlyIf(databases.includes('duckdb'), async () => {
|
|
203
|
+
await runUnsupportedRenderTest(
|
|
204
|
+
'duckdb',
|
|
205
|
+
runtimes,
|
|
206
|
+
"'\\xAA'::BLOB",
|
|
207
|
+
'{"type":"Buffer","data":[170]}'
|
|
208
|
+
);
|
|
209
|
+
})
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
test(
|
|
213
|
+
'can render unsupported duckdb uuid types',
|
|
214
|
+
onlyIf(databases.includes('duckdb'), async () => {
|
|
215
|
+
await runUnsupportedRenderTest(
|
|
216
|
+
'duckdb',
|
|
217
|
+
runtimes,
|
|
218
|
+
"'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::UUID",
|
|
219
|
+
'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
|
|
220
|
+
);
|
|
221
|
+
})
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
test(
|
|
225
|
+
'can render null unsupported types',
|
|
226
|
+
onlyIf(databases.includes('bigquery'), async () => {
|
|
227
|
+
await runUnsupportedRenderTest(
|
|
228
|
+
'bigquery',
|
|
229
|
+
runtimes,
|
|
230
|
+
'CAST(NULL AS GEOGRAPHY)',
|
|
231
|
+
'<span class="value-null">∅</span>'
|
|
232
|
+
);
|
|
233
|
+
})
|
|
234
|
+
);
|
|
193
235
|
|
|
194
236
|
describe('html renderer', () => {
|
|
195
237
|
describe('complex query with tags', () => {
|
package/src/util/index.ts
CHANGED
|
@@ -84,6 +84,19 @@ export function databasesFromEnvironmentOr(
|
|
|
84
84
|
: defaultDatabases;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
const describeSkip: jest.Describe = Object.assign(
|
|
88
|
+
(
|
|
89
|
+
name: number | string | Function | jest.FunctionLike,
|
|
90
|
+
fn: jest.EmptyFunction
|
|
91
|
+
) => describe.skip(name, fn),
|
|
92
|
+
{
|
|
93
|
+
skip: describe.skip,
|
|
94
|
+
// eslint-disable-next-line no-restricted-properties
|
|
95
|
+
only: describe.only,
|
|
96
|
+
each: (() => () => it.skip('skipped', () => {})) as unknown as jest.Each,
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
|
|
87
100
|
// confirms that one or more of the databases being tested overlaps with the databases a test suite can accept.
|
|
88
101
|
// if there is overlap, return a tuple of jest.describe and the dialects to be tested
|
|
89
102
|
// if there is no overlap, return a tuple if jest.describe.skip and the dialects to be tested
|
|
@@ -93,7 +106,7 @@ export function describeIfDatabaseAvailable(
|
|
|
93
106
|
const currentDatabases = databasesFromEnvironmentOr(acceptableDatabases);
|
|
94
107
|
const overlap = acceptableDatabases.filter(d => currentDatabases.includes(d));
|
|
95
108
|
|
|
96
|
-
return overlap.length > 0 ? [describe, overlap] : [
|
|
109
|
+
return overlap.length > 0 ? [describe, overlap] : [describeSkip, overlap];
|
|
97
110
|
}
|
|
98
111
|
|
|
99
112
|
interface InitValues {
|
|
@@ -206,6 +219,13 @@ export async function runQuery(runtime: Runtime, querySrc: string) {
|
|
|
206
219
|
return result;
|
|
207
220
|
}
|
|
208
221
|
|
|
209
|
-
export
|
|
210
|
-
|
|
211
|
-
|
|
222
|
+
export function onlyIf(
|
|
223
|
+
cond: boolean,
|
|
224
|
+
condTest: jest.ProvidesCallback
|
|
225
|
+
): jest.ProvidesCallback {
|
|
226
|
+
if (cond) {
|
|
227
|
+
return condTest;
|
|
228
|
+
} else {
|
|
229
|
+
return () => {};
|
|
230
|
+
}
|
|
231
|
+
}
|