@malloydata/malloy-tests 0.0.196-dev241008013446 → 0.0.196

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.196-dev241008013446",
25
- "@malloydata/db-duckdb": "^0.0.196-dev241008013446",
26
- "@malloydata/db-postgres": "^0.0.196-dev241008013446",
27
- "@malloydata/db-snowflake": "^0.0.196-dev241008013446",
28
- "@malloydata/db-trino": "^0.0.196-dev241008013446",
29
- "@malloydata/malloy": "^0.0.196-dev241008013446",
30
- "@malloydata/render": "^0.0.196-dev241008013446",
24
+ "@malloydata/db-bigquery": "^0.0.196",
25
+ "@malloydata/db-duckdb": "^0.0.196",
26
+ "@malloydata/db-postgres": "^0.0.196",
27
+ "@malloydata/db-snowflake": "^0.0.196",
28
+ "@malloydata/db-trino": "^0.0.196",
29
+ "@malloydata/malloy": "^0.0.196",
30
+ "@malloydata/render": "^0.0.196",
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.196-dev241008013446"
40
+ "version": "0.0.196"
41
41
  }
@@ -325,7 +325,7 @@ describe.each(runtimes.runtimeList)('%s', (databaseName, runtime) => {
325
325
 
326
326
  // TODO not sure why this test needs to be skipped on postgres, feels like an oversight
327
327
  // NOTE: unless underlying type is stored as a timestamp snowflake does not support extraction
328
- test.when(!['postgres', 'snowflake'].includes(databaseName))(
328
+ test.when(!['postgres', 'snowflake', 'mysql'].includes(databaseName))(
329
329
  'model: dates named',
330
330
  async () => {
331
331
  await expect(`
@@ -478,9 +478,8 @@ expressionModels.forEach((x, databaseName) => {
478
478
  });
479
479
 
480
480
  it(`properly isolated nested calculations - ${databaseName}`, async () => {
481
- const result = await expressionModel
482
- .loadQuery(
483
- `run: ${databaseName}.table('malloytest.airports') -> {
481
+ await expect(`
482
+ run: ${databaseName}.table('malloytest.airports') -> {
484
483
  group_by: faa_region
485
484
  aggregate: airport_count is count()
486
485
  calculate: id is row_number()
@@ -498,10 +497,10 @@ expressionModels.forEach((x, databaseName) => {
498
497
  // should be 2 rows, max of 2
499
498
  group_by: by_fac_type.id2
500
499
  order_by: id2 desc
501
- }`
502
- )
503
- .run();
504
- expect(result.data.path(0, 'id2').value).toBe(2);
500
+ }
501
+ `).malloyResultMatches(expressionModel, {
502
+ id2: 2,
503
+ });
505
504
  });
506
505
  });
507
506
 
@@ -944,7 +943,7 @@ expressionModels.forEach((x, databaseName) => {
944
943
  it(`trim works - ${databaseName}`, async () => {
945
944
  await funcTestMultiple(
946
945
  ["trim(' keep this ')", 'keep this'],
947
- ["trim('_ _keep_this_ _', '_ ')", 'keep_this'],
946
+ ["trim('__keep_this__', '_')", 'keep_this'],
948
947
  ["trim(' keep everything ', '')", ' keep everything '],
949
948
  ["trim('null example', null)", null],
950
949
  ["trim(null, 'a')", null],
@@ -956,7 +955,7 @@ expressionModels.forEach((x, databaseName) => {
956
955
  it(`ltrim works - ${databaseName}`, async () => {
957
956
  await funcTestMultiple(
958
957
  ["ltrim(' keep this -> ')", 'keep this -> '],
959
- ["ltrim('_ _keep_this -> _ _', '_ ')", 'keep_this -> _ _'],
958
+ ["ltrim('__keep_this -> __', '_')", 'keep_this -> __'],
960
959
  ["ltrim(' keep everything ', '')", ' keep everything '],
961
960
  ["ltrim('null example', null)", null],
962
961
  ["ltrim(null, 'a')", null],
@@ -968,7 +967,7 @@ expressionModels.forEach((x, databaseName) => {
968
967
  it(`rtrim works - ${databaseName}`, async () => {
969
968
  await funcTestMultiple(
970
969
  ["rtrim(' <- keep this ')", ' <- keep this'],
971
- ["rtrim('_ _ <- keep_this_ _', '_ ')", '_ _ <- keep_this'],
970
+ ["rtrim('__ <- keep_this__', '_')", '__ <- keep_this'],
972
971
  ["rtrim(' keep everything ', '')", ' keep everything '],
973
972
  ["rtrim('null example', null)", null],
974
973
  ["rtrim(null, 'a')", null],
@@ -994,7 +993,7 @@ expressionModels.forEach((x, databaseName) => {
994
993
  });
995
994
 
996
995
  describe('byte_length', () => {
997
- it(`works - ${databaseName}`, async () => {
996
+ it.when(databaseName !== 'mysql')(`works - ${databaseName}`, async () => {
998
997
  await funcTestMultiple(
999
998
  ["byte_length('hello')", 5],
1000
999
  ["byte_length('©')", 2],
@@ -1059,7 +1058,7 @@ expressionModels.forEach((x, databaseName) => {
1059
1058
  });
1060
1059
  });
1061
1060
  describe('unicode', () => {
1062
- it(`works - ${databaseName}`, async () => {
1061
+ it.when(databaseName !== 'mysql')(`works - ${databaseName}`, async () => {
1063
1062
  await funcTestMultiple(
1064
1063
  ["unicode('A')", 65],
1065
1064
  ["unicode('â')", 226],
@@ -1146,7 +1145,6 @@ expressionModels.forEach((x, databaseName) => {
1146
1145
  test.when(supported)('works generally', async () => {
1147
1146
  await expect(`
1148
1147
  // be accurate within 30%
1149
- // # test.debug
1150
1148
  run: ${databaseName}.table('malloytest.state_facts') -> {
1151
1149
  aggregate: passes is abs(count_approx(state)-count(state))/count(state) < 0.3
1152
1150
  aggregate: also_passes is abs(count_approx(airport_count)-count(airport_count))/count(airport_count) < 0.3
@@ -1445,7 +1443,11 @@ describe.each(runtimes.runtimeList)('%s', (databaseName, runtime) => {
1445
1443
 
1446
1444
  it(`works with fanout and order_by - ${databaseName}`, async () => {
1447
1445
  // TODO bigquery cannot handle both fanout and order_by today
1448
- if (['bigquery', 'snowflake', 'trino', 'presto'].includes(databaseName))
1446
+ if (
1447
+ ['bigquery', 'snowflake', 'trino', 'presto', 'mysql'].includes(
1448
+ databaseName
1449
+ )
1450
+ )
1449
1451
  return;
1450
1452
  await expect(`##! experimental.aggregate_order_by
1451
1453
  run: state_facts extend { join_many:
@@ -1464,7 +1466,7 @@ describe.each(runtimes.runtimeList)('%s', (databaseName, runtime) => {
1464
1466
 
1465
1467
  it(`works with fanout - ${databaseName}`, async () => {
1466
1468
  // Snowflake cannot handle the fanout case today
1467
- if (databaseName === 'snowflake') return;
1469
+ if (databaseName === 'snowflake' || databaseName === 'mysql') return;
1468
1470
  await expect(`##! experimental.aggregate_order_by
1469
1471
  run: state_facts extend { join_many:
1470
1472
  state_facts2 is ${databaseName}.table('malloytest.state_facts')
@@ -1480,7 +1482,7 @@ describe.each(runtimes.runtimeList)('%s', (databaseName, runtime) => {
1480
1482
 
1481
1483
  it(`works with fanout and separator - ${databaseName}`, async () => {
1482
1484
  // Snowflake cannot handle the fanout case today
1483
- if (databaseName === 'snowflake') return;
1485
+ if (databaseName === 'snowflake' || databaseName === 'mysql') return;
1484
1486
  await expect(`##! experimental.aggregate_order_by
1485
1487
  run: state_facts extend { join_many:
1486
1488
  state_facts2 is ${databaseName}.table('malloytest.state_facts')