@malloydata/malloy-tests 0.0.315 → 0.0.316
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 +9 -9
- package/src/core/bugless.spec.ts +4 -0
- package/src/core/events.spec.ts +4 -0
- package/src/core/experimental-dialects.spec.ts +1 -4
- package/src/core/sql_source.spec.ts +4 -0
- package/src/core/tags.spec.ts +4 -0
- package/src/databases/all/closeall.spec.ts +24 -0
- package/src/databases/bigquery/malloy_query.spec.ts +4 -0
- package/src/databases/duckdb/model_caching.spec.ts +4 -0
- package/src/runtimes.ts +20 -3
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.
|
|
25
|
-
"@malloydata/db-duckdb": "0.0.
|
|
26
|
-
"@malloydata/db-postgres": "0.0.
|
|
27
|
-
"@malloydata/db-snowflake": "0.0.
|
|
28
|
-
"@malloydata/db-trino": "0.0.
|
|
29
|
-
"@malloydata/malloy": "0.0.
|
|
30
|
-
"@malloydata/malloy-tag": "0.0.
|
|
31
|
-
"@malloydata/render": "0.0.
|
|
24
|
+
"@malloydata/db-bigquery": "0.0.316",
|
|
25
|
+
"@malloydata/db-duckdb": "0.0.316",
|
|
26
|
+
"@malloydata/db-postgres": "0.0.316",
|
|
27
|
+
"@malloydata/db-snowflake": "0.0.316",
|
|
28
|
+
"@malloydata/db-trino": "0.0.316",
|
|
29
|
+
"@malloydata/malloy": "0.0.316",
|
|
30
|
+
"@malloydata/malloy-tag": "0.0.316",
|
|
31
|
+
"@malloydata/render": "0.0.316",
|
|
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.
|
|
41
|
+
"version": "0.0.316"
|
|
42
42
|
}
|
package/src/core/bugless.spec.ts
CHANGED
package/src/core/events.spec.ts
CHANGED
|
@@ -74,10 +74,7 @@ describe('experimental dialects', () => {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
const connection = new DuckdbXConnection(
|
|
78
|
-
duckdbX,
|
|
79
|
-
'test/data/duckdb/duckdb_test.db'
|
|
80
|
-
);
|
|
77
|
+
const connection = new DuckdbXConnection(duckdbX, ':memory:');
|
|
81
78
|
|
|
82
79
|
class DuckdbXDialect extends DuckDBDialect {
|
|
83
80
|
experimental = true;
|
package/src/core/tags.spec.ts
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {RuntimeList, allDatabases} from '../../runtimes';
|
|
2
|
+
import {databasesFromEnvironmentOr} from '../../util';
|
|
3
|
+
import '../../util/db-jest-matchers';
|
|
4
|
+
|
|
5
|
+
const runtimes = new RuntimeList(databasesFromEnvironmentOr(allDatabases));
|
|
6
|
+
|
|
7
|
+
describe.each(runtimes.runtimeList)(
|
|
8
|
+
'connection close test %s',
|
|
9
|
+
(conName, runtime) => {
|
|
10
|
+
const n = runtime.dialect.sqlMaybeQuoteIdentifier('n');
|
|
11
|
+
test.each(Array.from({length: 50}, (_, i) => i + 1))(
|
|
12
|
+
'run SELECT %i',
|
|
13
|
+
async queryNum => {
|
|
14
|
+
await expect(`
|
|
15
|
+
run: ${conName}.sql("""SELECT ${queryNum} as ${n} """)
|
|
16
|
+
`).malloyResultMatches(runtime, {n: queryNum});
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
afterAll(async () => {
|
|
23
|
+
await runtimes.closeAll();
|
|
24
|
+
});
|
package/src/runtimes.ts
CHANGED
|
@@ -132,6 +132,17 @@ export class DuckDBTestConnection extends DuckDBConnection {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
export class DuckDBROTestConnection extends DuckDBTestConnection {
|
|
136
|
+
constructor(name: string, databasePath?: string, workingDirectory?: string) {
|
|
137
|
+
super({
|
|
138
|
+
name,
|
|
139
|
+
databasePath,
|
|
140
|
+
workingDirectory,
|
|
141
|
+
readOnly: true,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
135
146
|
export class DuckDBWASMTestConnection extends DuckDBWASMConnection {
|
|
136
147
|
// we probably need a better way to do this.
|
|
137
148
|
|
|
@@ -190,6 +201,12 @@ export function runtimeFor(dbName: string): SingleConnectionRuntime {
|
|
|
190
201
|
connection = new PostgresTestConnection(dbName);
|
|
191
202
|
break;
|
|
192
203
|
case 'duckdb':
|
|
204
|
+
connection = new DuckDBROTestConnection(
|
|
205
|
+
dbName,
|
|
206
|
+
'test/data/duckdb/duckdb_test.db'
|
|
207
|
+
);
|
|
208
|
+
break;
|
|
209
|
+
case 'duckdb_rw':
|
|
193
210
|
connection = new DuckDBTestConnection(
|
|
194
211
|
dbName,
|
|
195
212
|
'test/data/duckdb/duckdb_test.db'
|
|
@@ -298,8 +315,8 @@ export class RuntimeList {
|
|
|
298
315
|
for (const [_key, runtime] of this.runtimeMap) {
|
|
299
316
|
await runtime.connection.close();
|
|
300
317
|
}
|
|
301
|
-
//
|
|
302
|
-
//
|
|
303
|
-
await new Promise(resolve => setTimeout(resolve,
|
|
318
|
+
// TODO delete this line if it turns out not to be needed.
|
|
319
|
+
// At one time duckdb_wasm needed this
|
|
320
|
+
// await new Promise(resolve => setTimeout(resolve, 2000));
|
|
304
321
|
}
|
|
305
322
|
}
|