@malloydata/malloy-tests 0.0.135 → 0.0.136-dev240326234246

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.
Files changed (118) hide show
  1. package/dist/api.spec.d.ts +1 -0
  2. package/dist/api.spec.js +113 -0
  3. package/dist/api.spec.js.map +1 -0
  4. package/dist/databases/all/db_index.spec.d.ts +1 -0
  5. package/dist/databases/all/db_index.spec.js +126 -0
  6. package/dist/databases/all/db_index.spec.js.map +1 -0
  7. package/dist/databases/all/expr.spec.d.ts +1 -0
  8. package/dist/databases/all/expr.spec.js +652 -0
  9. package/dist/databases/all/expr.spec.js.map +1 -0
  10. package/dist/databases/all/functions.spec.d.ts +1 -0
  11. package/dist/databases/all/functions.spec.js +1180 -0
  12. package/dist/databases/all/functions.spec.js.map +1 -0
  13. package/dist/databases/all/join.spec.d.ts +1 -0
  14. package/dist/databases/all/join.spec.js +255 -0
  15. package/dist/databases/all/join.spec.js.map +1 -0
  16. package/dist/databases/all/lenses.spec.d.ts +1 -0
  17. package/dist/databases/all/lenses.spec.js +374 -0
  18. package/dist/databases/all/lenses.spec.js.map +1 -0
  19. package/dist/databases/all/nomodel.spec.d.ts +1 -0
  20. package/dist/databases/all/nomodel.spec.js +1070 -0
  21. package/dist/databases/all/nomodel.spec.js.map +1 -0
  22. package/dist/databases/all/orderby.spec.d.ts +1 -0
  23. package/dist/databases/all/orderby.spec.js +170 -0
  24. package/dist/databases/all/orderby.spec.js.map +1 -0
  25. package/dist/databases/all/problems.spec.d.ts +1 -0
  26. package/dist/databases/all/problems.spec.js +106 -0
  27. package/dist/databases/all/problems.spec.js.map +1 -0
  28. package/dist/databases/all/sql_expressions.spec.d.ts +1 -0
  29. package/dist/databases/all/sql_expressions.spec.js +73 -0
  30. package/dist/databases/all/sql_expressions.spec.js.map +1 -0
  31. package/dist/databases/all/time.spec.d.ts +1 -0
  32. package/dist/databases/all/time.spec.js +602 -0
  33. package/dist/databases/all/time.spec.js.map +1 -0
  34. package/dist/databases/bigquery/double_truncation.spec.d.ts +1 -0
  35. package/dist/databases/bigquery/double_truncation.spec.js +50 -0
  36. package/dist/databases/bigquery/double_truncation.spec.js.map +1 -0
  37. package/dist/databases/bigquery/handexpr.spec.d.ts +1 -0
  38. package/dist/databases/bigquery/handexpr.spec.js +723 -0
  39. package/dist/databases/bigquery/handexpr.spec.js.map +1 -0
  40. package/dist/databases/bigquery/injestion_time_partitioning.spec.d.ts +1 -0
  41. package/dist/databases/bigquery/injestion_time_partitioning.spec.js +235 -0
  42. package/dist/databases/bigquery/injestion_time_partitioning.spec.js.map +1 -0
  43. package/dist/databases/bigquery/joined_filters.spec.d.ts +1 -0
  44. package/dist/databases/bigquery/joined_filters.spec.js +72 -0
  45. package/dist/databases/bigquery/joined_filters.spec.js.map +1 -0
  46. package/dist/databases/bigquery/json.spec.d.ts +1 -0
  47. package/dist/databases/bigquery/json.spec.js +66 -0
  48. package/dist/databases/bigquery/json.spec.js.map +1 -0
  49. package/dist/databases/bigquery/malloy_query.spec.d.ts +1 -0
  50. package/dist/databases/bigquery/malloy_query.spec.js +840 -0
  51. package/dist/databases/bigquery/malloy_query.spec.js.map +1 -0
  52. package/dist/databases/bigquery/performance.skipped.spec.d.ts +1 -0
  53. package/dist/databases/bigquery/performance.skipped.spec.js +70 -0
  54. package/dist/databases/bigquery/performance.skipped.spec.js.map +1 -0
  55. package/dist/databases/bigquery/time.spec.d.ts +1 -0
  56. package/dist/databases/bigquery/time.spec.js +52 -0
  57. package/dist/databases/bigquery/time.spec.js.map +1 -0
  58. package/dist/databases/bigquery/wildcard_table_names.spec.d.ts +1 -0
  59. package/dist/databases/bigquery/wildcard_table_names.spec.js +212 -0
  60. package/dist/databases/bigquery/wildcard_table_names.spec.js.map +1 -0
  61. package/dist/databases/bigquery-duckdb/nested_source_table.spec.d.ts +1 -0
  62. package/dist/databases/bigquery-duckdb/nested_source_table.spec.js +213 -0
  63. package/dist/databases/bigquery-duckdb/nested_source_table.spec.js.map +1 -0
  64. package/dist/databases/duckdb/duckdb.spec.d.ts +1 -0
  65. package/dist/databases/duckdb/duckdb.spec.js +124 -0
  66. package/dist/databases/duckdb/duckdb.spec.js.map +1 -0
  67. package/dist/databases/duckdb/streaming.spec.d.ts +1 -0
  68. package/dist/databases/duckdb/streaming.spec.js +142 -0
  69. package/dist/databases/duckdb/streaming.spec.js.map +1 -0
  70. package/dist/databases/multi-connection/multi_connection.spec.d.ts +1 -0
  71. package/dist/databases/multi-connection/multi_connection.spec.js +120 -0
  72. package/dist/databases/multi-connection/multi_connection.spec.js.map +1 -0
  73. package/dist/databases/postgres/postgres.spec.d.ts +1 -0
  74. package/dist/databases/postgres/postgres.spec.js +140 -0
  75. package/dist/databases/postgres/postgres.spec.js.map +1 -0
  76. package/dist/databases/shared/test_list.d.ts +3 -0
  77. package/dist/databases/shared/test_list.js +5 -0
  78. package/dist/databases/shared/test_list.js.map +1 -0
  79. package/dist/databases/streaming/streaming.spec.d.ts +1 -0
  80. package/dist/databases/streaming/streaming.spec.js +93 -0
  81. package/dist/databases/streaming/streaming.spec.js.map +1 -0
  82. package/dist/dependencies.spec.d.ts +1 -0
  83. package/dist/dependencies.spec.js +63 -0
  84. package/dist/dependencies.spec.js.map +1 -0
  85. package/dist/index.d.ts +4 -0
  86. package/dist/index.js +49 -0
  87. package/dist/index.js.map +1 -0
  88. package/dist/jestMatcher.spec.d.ts +1 -0
  89. package/dist/jestMatcher.spec.js +81 -0
  90. package/dist/jestMatcher.spec.js.map +1 -0
  91. package/dist/model/sql_source.spec.d.ts +1 -0
  92. package/dist/model/sql_source.spec.js +47 -0
  93. package/dist/model/sql_source.spec.js.map +1 -0
  94. package/dist/models/faa_model.d.ts +5 -0
  95. package/dist/models/faa_model.js +997 -0
  96. package/dist/models/faa_model.js.map +1 -0
  97. package/dist/models/medicare_model.d.ts +4 -0
  98. package/dist/models/medicare_model.js +259 -0
  99. package/dist/models/medicare_model.js.map +1 -0
  100. package/dist/render/drill.spec.d.ts +1 -0
  101. package/dist/render/drill.spec.js +107 -0
  102. package/dist/render/drill.spec.js.map +1 -0
  103. package/dist/render/render.spec.d.ts +1 -0
  104. package/dist/render/render.spec.js +548 -0
  105. package/dist/render/render.spec.js.map +1 -0
  106. package/dist/runtimes.d.ts +35 -0
  107. package/dist/runtimes.js +180 -0
  108. package/dist/runtimes.js.map +1 -0
  109. package/dist/tags.spec.d.ts +8 -0
  110. package/dist/tags.spec.js +490 -0
  111. package/dist/tags.spec.js.map +1 -0
  112. package/dist/util/db-jest-matchers.d.ts +30 -0
  113. package/dist/util/db-jest-matchers.js +157 -0
  114. package/dist/util/db-jest-matchers.js.map +1 -0
  115. package/dist/util/index.d.ts +15 -0
  116. package/dist/util/index.js +182 -0
  117. package/dist/util/index.js.map +1 -0
  118. package/package.json +8 -8
@@ -0,0 +1,374 @@
1
+ "use strict";
2
+ /* eslint-disable no-console */
3
+ /*
4
+ * Copyright 2023 Google LLC
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining
7
+ * a copy of this software and associated documentation files
8
+ * (the "Software"), to deal in the Software without restriction,
9
+ * including without limitation the rights to use, copy, modify, merge,
10
+ * publish, distribute, sublicense, and/or sell copies of the Software,
11
+ * and to permit persons to whom the Software is furnished to do so,
12
+ * subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be
15
+ * included in all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+ const runtimes_1 = require("../../runtimes");
28
+ const util_1 = require("../../util");
29
+ require("../../util/db-jest-matchers");
30
+ // No prebuilt shared model, each test is complete. Makes debugging easier.
31
+ const runtimes = new runtimes_1.RuntimeList((0, util_1.databasesFromEnvironmentOr)(runtimes_1.allDatabases));
32
+ afterAll(async () => {
33
+ await runtimes.closeAll();
34
+ });
35
+ runtimes.runtimeMap.forEach((runtime, databaseName) => {
36
+ const q = runtime.getQuoter();
37
+ it(`named view plus named view - ${databaseName}`, async () => {
38
+ await expect(`
39
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
40
+ view: d is { group_by: n }
41
+ view: m is { aggregate: c is count() }
42
+ }
43
+ run: x -> d + m
44
+ `).malloyResultMatches(runtime, { n: 1, c: 1 });
45
+ });
46
+ it(`named view plus measure - ${databaseName}`, async () => {
47
+ await expect(`
48
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
49
+ view: d is { group_by: n }
50
+ measure: c is count()
51
+ }
52
+ run: x -> d + c
53
+ `).malloyResultMatches(runtime, { n: 1, c: 1 });
54
+ });
55
+ it(`dimension plus named view - ${databaseName}`, async () => {
56
+ await expect(`
57
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
58
+ view: m is { aggregate: c is count() }
59
+ }
60
+ run: x -> n + m
61
+ `).malloyResultMatches(runtime, { n: 1, c: 1 });
62
+ });
63
+ it(`where headed - ${databaseName}`, async () => {
64
+ await expect(`
65
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
66
+ view: m is { aggregate: c is count() }
67
+ }
68
+ run: x -> { where: true } + m
69
+ `).malloyResultMatches(runtime, { c: 1 });
70
+ });
71
+ it(`named view plus named view in source - ${databaseName}`, async () => {
72
+ await expect(`
73
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
74
+ view: d is { group_by: n }
75
+ view: m is { aggregate: c is count() }
76
+ view: y is d + m
77
+ }
78
+ run: x -> y
79
+ `).malloyResultMatches(runtime, { n: 1, c: 1 });
80
+ });
81
+ it(`dimension plus named view in source - ${databaseName}`, async () => {
82
+ await expect(`
83
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
84
+ view: m is { aggregate: c is count() }
85
+ view: y is n + m
86
+ }
87
+ run: x -> y
88
+ `).malloyResultMatches(runtime, { n: 1, c: 1 });
89
+ });
90
+ it(`named view plus dimension in source - ${databaseName}`, async () => {
91
+ await expect(`
92
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
93
+ view: m is { aggregate: c is count() }
94
+ view: y is m + n
95
+ }
96
+ run: x -> y
97
+ `).malloyResultMatches(runtime, { n: 1, c: 1 });
98
+ });
99
+ it(`literal view plus named view - ${databaseName}`, async () => {
100
+ await expect(`
101
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
102
+ view: m is { aggregate: c is count() }
103
+ }
104
+ run: x -> { group_by: n } + m
105
+ `).malloyResultMatches(runtime, { n: 1, c: 1 });
106
+ });
107
+ it(`literal view plus measure - ${databaseName}`, async () => {
108
+ await expect(`
109
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
110
+ measure: c is count()
111
+ }
112
+ run: x -> { group_by: n } + c
113
+ `).malloyResultMatches(runtime, { n: 1, c: 1 });
114
+ });
115
+ it(`measure plus literal view - ${databaseName}`, async () => {
116
+ await expect(`
117
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
118
+ measure: c is count()
119
+ }
120
+ run: x -> c + { group_by: n }
121
+ `).malloyResultMatches(runtime, { n: 1, c: 1 });
122
+ });
123
+ it(`literal view plus named view in source - ${databaseName}`, async () => {
124
+ await expect(`
125
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
126
+ view: m is { aggregate: c is count() }
127
+ view: y is { group_by: n } + m
128
+ }
129
+ run: x -> y
130
+ `).malloyResultMatches(runtime, { n: 1, c: 1 });
131
+ });
132
+ it(`literal view plus measure in source - ${databaseName}`, async () => {
133
+ await expect(`
134
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
135
+ measure: c is count()
136
+ view: y is { group_by: n } + c
137
+ }
138
+ run: x -> y
139
+ `).malloyResultMatches(runtime, { n: 1, c: 1 });
140
+ });
141
+ it(`named view plus literal view - ${databaseName}`, async () => {
142
+ await expect(`
143
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
144
+ view: d is { group_by: n }
145
+ }
146
+ run: x -> d + { aggregate: c is count() }
147
+ `).malloyResultMatches(runtime, { n: 1, c: 1 });
148
+ });
149
+ it(`literal view plus literal view - ${databaseName}`, async () => {
150
+ await expect(`
151
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}')
152
+ run: x -> { group_by: n } + { aggregate: c is count() }
153
+ `).malloyResultMatches(runtime, { n: 1, c: 1 });
154
+ });
155
+ it(`three named views - ${databaseName}`, async () => {
156
+ await expect(`
157
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
158
+ view: d1 is { group_by: n1 is n }
159
+ view: d2 is { group_by: n2 is n }
160
+ view: m is { aggregate: c is count() }
161
+ }
162
+ run: x -> d1 + d2 + m
163
+ `).malloyResultMatches(runtime, { n1: 1, n2: 1, c: 1 });
164
+ });
165
+ it(`nested no name - ${databaseName}`, async () => {
166
+ await expect(`
167
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
168
+ view: d is { group_by: n }
169
+ view: m is { aggregate: c is count() }
170
+ }
171
+ run: x -> {
172
+ nest: d + m
173
+ }
174
+ `).malloyResultMatches(runtime, { 'd.n': 1, 'd.c': 1 });
175
+ });
176
+ it(`nested with name - ${databaseName}`, async () => {
177
+ await expect(`
178
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
179
+ view: d is { group_by: n }
180
+ view: m is { aggregate: c is count() }
181
+ }
182
+ run: x -> {
183
+ nest: y is d + m
184
+ }
185
+ `).malloyResultMatches(runtime, { 'y.n': 1, 'y.c': 1 });
186
+ });
187
+ it(`nested no name with dimension head - ${databaseName}`, async () => {
188
+ await expect(`
189
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
190
+ view: m is { aggregate: c is count() }
191
+ }
192
+ run: x -> {
193
+ nest: n + m
194
+ }
195
+ `).malloyResultMatches(runtime, { 'n.n': 1, 'n.c': 1 });
196
+ });
197
+ it(`nest dimension only - ${databaseName}`, async () => {
198
+ await expect(`
199
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
200
+ view: m is { aggregate: c is count() }
201
+ }
202
+ run: x -> {
203
+ nest: n
204
+ }
205
+ `).malloyResultMatches(runtime, { 'n.n': 1 });
206
+ });
207
+ it(`joined dimension in middle of refinements - ${databaseName}`, async () => {
208
+ await expect(`
209
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
210
+ join_one: y is ${databaseName}.sql('SELECT 2 as ${q `n`}') on true
211
+ view: m is { aggregate: c is count() }
212
+ }
213
+ run: x -> m + y.n + { limit: 1 }
214
+ `).malloyResultMatches(runtime, { 'n': 2, 'c': 1 });
215
+ });
216
+ it(`nest joined dimension refined - ${databaseName}`, async () => {
217
+ await expect(`
218
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
219
+ join_one: y is ${databaseName}.sql('SELECT 1 as ${q `n`}') on true
220
+ view: m is { aggregate: c is count() }
221
+ }
222
+ run: x -> {
223
+ nest: y.n + { limit: 1 }
224
+ }
225
+ `).malloyResultMatches(runtime, { 'n.n': 1 });
226
+ });
227
+ it(`joined dimension refined - ${databaseName}`, async () => {
228
+ await expect(`
229
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
230
+ join_one: y is ${databaseName}.sql('SELECT 2 as ${q `n`}') on true
231
+ view: m is { aggregate: c is count() }
232
+ }
233
+ run: x -> y.n + { limit: 1 }
234
+ `).malloyResultMatches(runtime, { 'n': 2 });
235
+ });
236
+ it(`nest joined dimension bare - ${databaseName}`, async () => {
237
+ await expect(`
238
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
239
+ join_one: y is ${databaseName}.sql('SELECT 2 as ${q `n`}') on true
240
+ view: m is { aggregate: c is count() }
241
+ }
242
+ run: x -> {
243
+ nest: y.n
244
+ }
245
+ `).malloyResultMatches(runtime, { 'n.n': 2 });
246
+ });
247
+ it(`joined dimension bare - ${databaseName}`, async () => {
248
+ await expect(`
249
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
250
+ join_one: y is ${databaseName}.sql('SELECT 2 as ${q `n`}') on true
251
+ view: m is { aggregate: c is count() }
252
+ }
253
+ run: x -> y.n
254
+ `).malloyResultMatches(runtime, { 'n': 2 });
255
+ });
256
+ it(`joined dimension nest refinement - ${databaseName}`, async () => {
257
+ await expect(`
258
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
259
+ join_one: y is ${databaseName}.sql('SELECT 2 as ${q `n`}') on true
260
+ view: m is { aggregate: c is count() }
261
+ }
262
+ run: x -> { nest: m + y.n }
263
+ `).malloyResultMatches(runtime, { 'm.c': 1, 'm.n': 2 });
264
+ });
265
+ it.skip(`nest measure only in second stage - ${databaseName}`, async () => {
266
+ await expect(`
267
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
268
+ view: m is { aggregate: c is count() }
269
+ }
270
+ run: x -> m -> {
271
+ nest: c
272
+ }
273
+ `).malloyResultMatches(runtime, { 'm.c': 1 });
274
+ });
275
+ it(`nest dimension only in refinement - ${databaseName}`, async () => {
276
+ await expect(`
277
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
278
+ view: m is { aggregate: c is count() }
279
+ }
280
+ run: x -> m + {
281
+ nest: n
282
+ }
283
+ `).malloyResultMatches(runtime, { 'n.n': 1, 'c': 1 });
284
+ });
285
+ it(`view dimension only - ${databaseName}`, async () => {
286
+ await expect(`
287
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
288
+ view: m is n
289
+ }
290
+ run: x -> m
291
+ `).malloyResultMatches(runtime, { n: 1 });
292
+ });
293
+ it(`view join dimension only - ${databaseName}`, async () => {
294
+ await expect(`
295
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
296
+ join_one: y is ${databaseName}.sql('SELECT 2 as ${q `n`}') on true
297
+ view: m is y.n
298
+ }
299
+ run: x -> m
300
+ `).malloyResultMatches(runtime, { n: 2 });
301
+ });
302
+ it(`run dimension only - ${databaseName}`, async () => {
303
+ await expect(`
304
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}')
305
+ run: x -> n
306
+ `).malloyResultMatches(runtime, { n: 1 });
307
+ });
308
+ it.skip(`second stage refinement chain - ${databaseName}`, async () => {
309
+ await expect(`
310
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}')
311
+ run: x -> n -> n + { aggregate: c is count() }
312
+ `).malloyResultMatches(runtime, { n: 1, c: 1 });
313
+ });
314
+ it.skip(`second stage refinement chain in nest - ${databaseName}`, async () => {
315
+ await expect(`
316
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
317
+ view: v is n -> n + { aggregate: c is count() }
318
+ }
319
+ `).malloyResultMatches(runtime, { n: 1, c: 1 });
320
+ });
321
+ it(`copy of view with lens - ${databaseName}`, async () => {
322
+ await expect(`
323
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
324
+ view: metrics is { aggregate: c is count() }
325
+ view: v is { group_by: n } + metrics
326
+ view: v2 is v
327
+ }
328
+ run: x -> v2
329
+ `).malloyResultMatches(runtime, { n: 1, c: 1 });
330
+ });
331
+ it(`aggregate copy bug with only old refinement - ${databaseName}`, async () => {
332
+ await expect(`
333
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
334
+ measure: c is count()
335
+ }
336
+ run: x -> c + {
337
+ aggregate: e is c { where: false }
338
+ }
339
+ `).malloyResultMatches(runtime, { c: 1, e: 0 });
340
+ });
341
+ it(`aggregate copy bug with only old old refinement - ${databaseName}`, async () => {
342
+ await expect(`
343
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
344
+ measure: c is count()
345
+ view: v is { aggregate: c }
346
+ }
347
+ run: x -> v + {
348
+ aggregate: e is c { where: false }
349
+ }
350
+ `).malloyResultMatches(runtime, { c: 1, e: 0 });
351
+ });
352
+ it(`but still need to be able to use as output field - ${databaseName}`, async () => {
353
+ await expect(`
354
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
355
+ measure: c is count()
356
+ view: v is { aggregate: c }
357
+ }
358
+ run: x -> v + {
359
+ calculate: e is lag(c)
360
+ }
361
+ `).malloyResultMatches(runtime, { c: 1, e: null });
362
+ });
363
+ it(`aggregate copy bug - ${databaseName}`, async () => {
364
+ await expect(`
365
+ source: x is ${databaseName}.sql('SELECT 1 as ${q `n`}') extend {
366
+ measure: c is count()
367
+ }
368
+ run: x -> n + c + {
369
+ aggregate: e is c { where: false }
370
+ }
371
+ `).malloyResultMatches(runtime, { n: 1, c: 1, e: 0 });
372
+ });
373
+ });
374
+ //# sourceMappingURL=lenses.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lenses.spec.js","sourceRoot":"","sources":["../../../src/databases/all/lenses.spec.ts"],"names":[],"mappings":";AAAA,+BAA+B;AAC/B;;;;;;;;;;;;;;;;;;;;;GAqBG;;AAEH,8DAA8D;AAE9D,6CAAyD;AACzD,qCAAsD;AACtD,uCAAqC;AACrC,4EAA4E;AAE5E,MAAM,QAAQ,GAAG,IAAI,sBAAW,CAAC,IAAA,iCAA0B,EAAC,uBAAY,CAAC,CAAC,CAAC;AAE3E,QAAQ,CAAC,KAAK,IAAI,EAAE;IAClB,MAAM,QAAQ,CAAC,QAA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