@malloydata/malloy-tests 0.0.265-dev250416204239 → 0.0.265-dev250417230458

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,14 +21,14 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@jest/globals": "^29.4.3",
24
- "@malloydata/db-bigquery": "^0.0.265-dev250416204239",
25
- "@malloydata/db-duckdb": "^0.0.265-dev250416204239",
26
- "@malloydata/db-postgres": "^0.0.265-dev250416204239",
27
- "@malloydata/db-snowflake": "^0.0.265-dev250416204239",
28
- "@malloydata/db-trino": "^0.0.265-dev250416204239",
29
- "@malloydata/malloy": "^0.0.265-dev250416204239",
30
- "@malloydata/malloy-tag": "^0.0.265-dev250416204239",
31
- "@malloydata/render": "^0.0.265-dev250416204239",
24
+ "@malloydata/db-bigquery": "^0.0.265-dev250417230458",
25
+ "@malloydata/db-duckdb": "^0.0.265-dev250417230458",
26
+ "@malloydata/db-postgres": "^0.0.265-dev250417230458",
27
+ "@malloydata/db-snowflake": "^0.0.265-dev250417230458",
28
+ "@malloydata/db-trino": "^0.0.265-dev250417230458",
29
+ "@malloydata/malloy": "^0.0.265-dev250417230458",
30
+ "@malloydata/malloy-tag": "^0.0.265-dev250417230458",
31
+ "@malloydata/render": "^0.0.265-dev250417230458",
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.265-dev250416204239"
41
+ "version": "0.0.265-dev250417230458"
42
42
  }
@@ -42,13 +42,7 @@ describe.each(runtimes.runtimeList)('filter expressions %s', (dbName, db) => {
42
42
  }`).malloyResultMatches(abc, [{s: 'abc'}]);
43
43
  });
44
44
  test('empty string filter expression', async () => {
45
- /*
46
- since the sql generated works when pasted into mysql
47
- my next suggestion is that there is some funky re-ordering
48
- happening in the result processing which will test tomorrow
49
- */
50
45
  await expect(`
51
- # test.verbose
52
46
  run: abc -> {
53
47
  where: s ~ f'';
54
48
  select: *; order_by: nm asc
@@ -111,11 +105,15 @@ describe.each(runtimes.runtimeList)('filter expressions %s', (dbName, db) => {
111
105
  });
112
106
  test('empty', async () => {
113
107
  await expect(`
114
- # test.verbose
115
108
  run: abc -> {
116
109
  where: s ~ f'empty'
117
110
  select: nm; order_by: nm asc
118
111
  }`).malloyResultMatches(abc, got('z-empty,z-null'));
112
+ await expect(`
113
+ run: abc -> {
114
+ where: s ~ f'EmpTy'
115
+ select: nm; order_by: nm asc
116
+ }`).malloyResultMatches(abc, got('z-empty,z-null'));
119
117
  });
120
118
  test('-empty', async () => {
121
119
  await expect(`
@@ -127,11 +125,15 @@ describe.each(runtimes.runtimeList)('filter expressions %s', (dbName, db) => {
127
125
  });
128
126
  test('null', async () => {
129
127
  await expect(`
130
- # test.verbose
131
128
  run: abc -> {
132
129
  where: s ~ f'null'
133
130
  select: nm
134
131
  }`).malloyResultMatches(abc, got('z-null'));
132
+ await expect(`
133
+ run: abc -> {
134
+ where: s ~ f'nULl'
135
+ select: nm
136
+ }`).malloyResultMatches(abc, got('z-null'));
135
137
  });
136
138
  test('-null', async () => {
137
139
  await expect(`
@@ -194,6 +196,18 @@ describe.each(runtimes.runtimeList)('filter expressions %s', (dbName, db) => {
194
196
  UNION ALL SELECT NULL, 'null'
195
197
  """)
196
198
  `);
199
+ test('numeric filters are case insensitive', async () => {
200
+ await expect(`
201
+ run: nums -> {
202
+ where: n ~ f'([1 tO 3] aNd [1 To 4]) oR NuLl'
203
+ select: t; order_by: t asc
204
+ }`).malloyResultMatches(nums, [
205
+ {t: '1'},
206
+ {t: '2'},
207
+ {t: '3'},
208
+ {t: 'null'},
209
+ ]);
210
+ });
197
211
  test('empty numeric filter', async () => {
198
212
  await expect(`
199
213
  run: nums -> {
@@ -320,42 +334,35 @@ describe.each(runtimes.runtimeList)('filter expressions %s', (dbName, db) => {
320
334
  test.when(testBoolean)('true', async () => {
321
335
  await expect(`
322
336
  run: facts -> {
323
- where: b ~ f'true'
324
- select: t; order_by: t asc
325
- }`).malloyResultMatches(facts, [{t: 'true'}]);
326
- });
327
- test.when(testBoolean)('true', async () => {
328
- await expect(`
329
- run: facts -> {
330
- where: b ~ f'true'
337
+ where: b ~ f'tRuE'
331
338
  select: t; order_by: t asc
332
339
  }`).malloyResultMatches(facts, [{t: 'true'}]);
333
340
  });
334
341
  test.when(testBoolean)('false', async () => {
335
342
  await expect(`
336
343
  run: facts -> {
337
- where: b ~ f'false'
344
+ where: b ~ f'FalSE'
338
345
  select: t; order_by: t asc
339
346
  }`).malloyResultMatches(facts, [{t: 'false'}, {t: 'null'}]);
340
347
  });
341
348
  test.when(testBoolean)('=false', async () => {
342
349
  await expect(`
343
350
  run: facts -> {
344
- where: b ~ f'=false'
351
+ where: b ~ f'=FALSE'
345
352
  select: t; order_by: t asc
346
353
  }`).malloyResultMatches(facts, [{t: 'false'}]);
347
354
  });
348
355
  test.when(testBoolean)('null', async () => {
349
356
  await expect(`
350
357
  run: facts -> {
351
- where: b ~ f'null'
358
+ where: b ~ f'Null'
352
359
  select: t; order_by: t asc
353
360
  }`).malloyResultMatches(facts, [{t: 'null'}]);
354
361
  });
355
362
  test.when(testBoolean)('not null', async () => {
356
363
  await expect(`
357
364
  run: facts -> {
358
- where: b ~ f'not null'
365
+ where: b ~ f'nOt NuLL'
359
366
  select: t; order_by: t asc
360
367
  }`).malloyResultMatches(facts, [{t: 'false'}, {t: 'true'}]);
361
368
  });
@@ -459,7 +466,7 @@ describe.each(runtimes.runtimeList)('filter expressions %s', (dbName, db) => {
459
466
  test('date after quarter', async () => {
460
467
  const range = mkDateRange('2001-01-01', '2001-04-01');
461
468
  await expect(`
462
- run: range + { where: t ~ f'after 2001-Q1' }
469
+ run: range + { where: t ~ f'AFTER 2001-Q1' }
463
470
  `).malloyResultMatches(range, {n: 'post-range'});
464
471
  });
465
472
  test('date before month', async () => {
@@ -798,8 +805,20 @@ describe.each(runtimes.runtimeList)('filter expressions %s', (dbName, db) => {
798
805
  nowIs('2023-01-03 00:00:00');
799
806
  const range = mkRange('2023-01-07 00:00:00', '2023-01-08 00:00:00');
800
807
  await expect(`
801
- run: range + { where: t ~ f'next saturday' }
808
+ run: range + { where: t ~ f'next Saturday' }
802
809
  `).malloyResultMatches(range, inRange);
803
810
  });
811
+ test('temporal filters are case insensitive', async () => {
812
+ nowIs('2023-01-03 00:00:00');
813
+ const range = mkRange('2023-01-04 00:00:00', '2023-01-05 00:00:00');
814
+ await expect(`
815
+ run: range + {where: t ~ f'Null Or noT aFter TomoRRow'}`).matchesRows(
816
+ range,
817
+ {n: 'before'},
818
+ {n: 'first'},
819
+ {n: 'last'},
820
+ {n: 'z-null'}
821
+ );
822
+ });
804
823
  });
805
824
  });