@malloydata/malloy-tests 0.0.227-dev250113233420 → 0.0.227
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 +8 -8
- package/src/core/api.spec.ts +40 -0
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.227
|
|
25
|
-
"@malloydata/db-duckdb": "^0.0.227
|
|
26
|
-
"@malloydata/db-postgres": "^0.0.227
|
|
27
|
-
"@malloydata/db-snowflake": "^0.0.227
|
|
28
|
-
"@malloydata/db-trino": "^0.0.227
|
|
29
|
-
"@malloydata/malloy": "^0.0.227
|
|
30
|
-
"@malloydata/render": "^0.0.227
|
|
24
|
+
"@malloydata/db-bigquery": "^0.0.227",
|
|
25
|
+
"@malloydata/db-duckdb": "^0.0.227",
|
|
26
|
+
"@malloydata/db-postgres": "^0.0.227",
|
|
27
|
+
"@malloydata/db-snowflake": "^0.0.227",
|
|
28
|
+
"@malloydata/db-trino": "^0.0.227",
|
|
29
|
+
"@malloydata/malloy": "^0.0.227",
|
|
30
|
+
"@malloydata/render": "^0.0.227",
|
|
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.227
|
|
40
|
+
"version": "0.0.227"
|
|
41
41
|
}
|
package/src/core/api.spec.ts
CHANGED
|
@@ -145,4 +145,44 @@ describe('tags', () => {
|
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
147
|
|
|
148
|
+
describe('default row limit', () => {
|
|
149
|
+
test('default row limit gets added to query', async () => {
|
|
150
|
+
const query = runtime.loadQuery(
|
|
151
|
+
"run: duckdb.table('malloytest.aircraft') -> { group_by: state }"
|
|
152
|
+
);
|
|
153
|
+
const result = await query.run({defaultRowLimit: 1});
|
|
154
|
+
expect(result.data.rowCount).toBe(1);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test('default row limit does not get added to raw query', async () => {
|
|
158
|
+
const query = runtime.loadQuery(
|
|
159
|
+
`
|
|
160
|
+
run: duckdb.sql("""
|
|
161
|
+
SELECT 1 as value
|
|
162
|
+
UNION ALL
|
|
163
|
+
SELECT 2 as value
|
|
164
|
+
""")
|
|
165
|
+
`
|
|
166
|
+
);
|
|
167
|
+
const result = await query.run({defaultRowLimit: 1});
|
|
168
|
+
expect(result.data.rowCount).toBe(2);
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
test('default row limit does not override existing limit', async () => {
|
|
172
|
+
const query = runtime.loadQuery(
|
|
173
|
+
"run: duckdb.table('malloytest.aircraft') -> { group_by: state; limit: 2 }"
|
|
174
|
+
);
|
|
175
|
+
const result = await query.run({defaultRowLimit: 1});
|
|
176
|
+
expect(result.data.rowCount).toBe(2);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
test('no default row limit does not add row limit', async () => {
|
|
180
|
+
const query = runtime.loadQuery(
|
|
181
|
+
"run: duckdb.table('malloytest.aircraft') -> { group_by: state }"
|
|
182
|
+
);
|
|
183
|
+
const result = await query.run();
|
|
184
|
+
expect(result.data.rowCount).toBe(10); // Weird that there are only 10 states in this table?
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
|
|
148
188
|
afterAll(async () => await runtime.connection.close());
|