@malloydata/malloy-tests 0.0.236-dev250221002909 → 0.0.236-dev250221173808
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,13 +21,13 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@jest/globals": "^29.4.3",
|
|
24
|
-
"@malloydata/db-bigquery": "^0.0.236-
|
|
25
|
-
"@malloydata/db-duckdb": "^0.0.236-
|
|
26
|
-
"@malloydata/db-postgres": "^0.0.236-
|
|
27
|
-
"@malloydata/db-snowflake": "^0.0.236-
|
|
28
|
-
"@malloydata/db-trino": "^0.0.236-
|
|
29
|
-
"@malloydata/malloy": "^0.0.236-
|
|
30
|
-
"@malloydata/render": "^0.0.236-
|
|
24
|
+
"@malloydata/db-bigquery": "^0.0.236-dev250221173808",
|
|
25
|
+
"@malloydata/db-duckdb": "^0.0.236-dev250221173808",
|
|
26
|
+
"@malloydata/db-postgres": "^0.0.236-dev250221173808",
|
|
27
|
+
"@malloydata/db-snowflake": "^0.0.236-dev250221173808",
|
|
28
|
+
"@malloydata/db-trino": "^0.0.236-dev250221173808",
|
|
29
|
+
"@malloydata/malloy": "^0.0.236-dev250221173808",
|
|
30
|
+
"@malloydata/render": "^0.0.236-dev250221173808",
|
|
31
31
|
"events": "^3.3.0",
|
|
32
32
|
"jsdom": "^22.1.0",
|
|
33
33
|
"luxon": "^2.4.0",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"@types/jsdom": "^21.1.1",
|
|
38
38
|
"@types/luxon": "^2.4.0"
|
|
39
39
|
},
|
|
40
|
-
"version": "0.0.236-
|
|
40
|
+
"version": "0.0.236-dev250221173808"
|
|
41
41
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import {Runtime} from '@malloydata/malloy';
|
|
8
9
|
import {RuntimeList, allDatabases} from '../../runtimes';
|
|
9
10
|
import {databasesFromEnvironmentOr} from '../../util';
|
|
10
11
|
import '../../util/db-jest-matchers';
|
|
@@ -401,4 +402,50 @@ describe.each(runtimes.runtimeList)('%s', (databaseName, runtime) => {
|
|
|
401
402
|
`).malloyResultMatches(runtime, {fieldName: 'bar'});
|
|
402
403
|
});
|
|
403
404
|
});
|
|
405
|
+
it('composite with parameters in separate file', async () => {
|
|
406
|
+
const wrappedRuntime = new Runtime({
|
|
407
|
+
connections: runtime.connections,
|
|
408
|
+
urlReader: {
|
|
409
|
+
readURL(_url: URL) {
|
|
410
|
+
return Promise.resolve(`
|
|
411
|
+
##! experimental { composite_sources parameters }
|
|
412
|
+
source: state_facts is ${databaseName}.table('malloytest.state_facts')
|
|
413
|
+
source: x(param is 2) is compose(
|
|
414
|
+
state_facts extend { dimension: a is 1 },
|
|
415
|
+
state_facts extend { dimension: b is 2 }
|
|
416
|
+
) extend {
|
|
417
|
+
where: param = 1
|
|
418
|
+
}
|
|
419
|
+
`);
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
});
|
|
423
|
+
await expect(`
|
|
424
|
+
import "http://foo.malloy"
|
|
425
|
+
##! experimental { composite_sources parameters }
|
|
426
|
+
run: x(param is 1) -> { group_by: b }
|
|
427
|
+
`).malloyResultMatches(wrappedRuntime, {b: 2});
|
|
428
|
+
});
|
|
429
|
+
it('composite with parameters in separate file passing parameter to use in extended compose', async () => {
|
|
430
|
+
const wrappedRuntime = new Runtime({
|
|
431
|
+
connections: runtime.connections,
|
|
432
|
+
urlReader: {
|
|
433
|
+
readURL(_url: URL) {
|
|
434
|
+
return Promise.resolve(`
|
|
435
|
+
##! experimental { composite_sources parameters }
|
|
436
|
+
source: state_facts is ${databaseName}.table('malloytest.state_facts')
|
|
437
|
+
source: x(param is 1) is compose(
|
|
438
|
+
state_facts extend { dimension: a is param },
|
|
439
|
+
state_facts extend { dimension: b is param + 1 }
|
|
440
|
+
)
|
|
441
|
+
`);
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
});
|
|
445
|
+
await expect(`
|
|
446
|
+
import "http://foo.malloy"
|
|
447
|
+
##! experimental { composite_sources parameters }
|
|
448
|
+
run: x(param is 2) -> { group_by: b }
|
|
449
|
+
`).malloyResultMatches(wrappedRuntime, {b: 3});
|
|
450
|
+
});
|
|
404
451
|
});
|