diff --git a/packages/operators/src/runInstance.js b/packages/operators/src/runInstance.js index eecc75541..b2ef09057 100644 --- a/packages/operators/src/runInstance.js +++ b/packages/operators/src/runInstance.js @@ -3,7 +3,7 @@ import { type } from '@lowdefy/helpers'; const runInstance = ({ location, meta, methodName, operator, params, instanceType }) => { if (!meta[methodName]) { throw new Error( - `Operator Error: ${operator}.${methodName} is not supported, use one of the following types: ${Object.keys( + `Operator Error: ${operator}.${methodName} is not supported, use one of the following: ${Object.keys( meta ).join(', ')}. Received: {"${operator}.${methodName}":${JSON.stringify(params)}} at ${location}.` diff --git a/packages/operators/test/common/array.test.js b/packages/operators/test/common/array.test.js index c1b61bc47..785181d71 100644 --- a/packages/operators/test/common/array.test.js +++ b/packages/operators/test/common/array.test.js @@ -715,7 +715,7 @@ describe('_array.length', () => { test('_array called with no method or params', () => { expect(() => array({ location: 'locationId' })).toThrowErrorMatchingInlineSnapshot(` - "Operator Error: _array.undefined is not supported, use one of the following types: concat, copyWithin, fill, flat, includes, indexOf, join, lastIndexOf, reverse, slice, sort, splice, length. + "Operator Error: _array.undefined is not supported, use one of the following: concat, copyWithin, fill, flat, includes, indexOf, join, lastIndexOf, reverse, slice, sort, splice, length. Received: {\\"_array.undefined\\":undefined} at locationId." `); }); @@ -723,7 +723,7 @@ test('_array called with no method or params', () => { test('_array invalid method', () => { expect(() => array({ params: [['a']], methodName: 'X', location: 'locationId' })) .toThrowErrorMatchingInlineSnapshot(` - "Operator Error: _array.X is not supported, use one of the following types: concat, copyWithin, fill, flat, includes, indexOf, join, lastIndexOf, reverse, slice, sort, splice, length. + "Operator Error: _array.X is not supported, use one of the following: concat, copyWithin, fill, flat, includes, indexOf, join, lastIndexOf, reverse, slice, sort, splice, length. Received: {\\"_array.X\\":[[\\"a\\"]]} at locationId." `); }); diff --git a/packages/operators/test/common/math.test.js b/packages/operators/test/common/math.test.js index bfe552184..801911607 100644 --- a/packages/operators/test/common/math.test.js +++ b/packages/operators/test/common/math.test.js @@ -2,14 +2,14 @@ import _math from '../../src/common/math'; test('_math called with no method or params', () => { expect(() => _math({ location: 'locationId' })).toThrowErrorMatchingInlineSnapshot(` - "Operator Error: _math requires a valid method name, use one of the following types: abs, acos, acosh, asin, asinh, atan, atan2, atanh, cbrt, ceil, clz32, cos, cosh, exp, expm1, floor, fround, hypot, imul, log, log10, log1p, log2, max, min, pow, random, round, sign, sin, sinh, sqrt, tan, tanh, trunc, E, LN10, LN2, LOG10E, LOG2E, PI, SQRT1_2, SQRT2. + "Operator Error: _math requires a valid method name, use one of the following: abs, acos, acosh, asin, asinh, atan, atan2, atanh, cbrt, ceil, clz32, cos, cosh, exp, expm1, floor, fround, hypot, imul, log, log10, log1p, log2, max, min, pow, random, round, sign, sin, sinh, sqrt, tan, tanh, trunc, E, LN10, LN2, LOG10E, LOG2E, PI, SQRT1_2, SQRT2. Received: {\\"_math.undefined\\":undefined} at locationId." `); }); test('_math invalid method or params', () => { expect(() => _math({ params: 'X', location: 'locationId' })).toThrowErrorMatchingInlineSnapshot(` - "Operator Error: _math requires a valid method name, use one of the following types: abs, acos, acosh, asin, asinh, atan, atan2, atanh, cbrt, ceil, clz32, cos, cosh, exp, expm1, floor, fround, hypot, imul, log, log10, log1p, log2, max, min, pow, random, round, sign, sin, sinh, sqrt, tan, tanh, trunc, E, LN10, LN2, LOG10E, LOG2E, PI, SQRT1_2, SQRT2. + "Operator Error: _math requires a valid method name, use one of the following: abs, acos, acosh, asin, asinh, atan, atan2, atanh, cbrt, ceil, clz32, cos, cosh, exp, expm1, floor, fround, hypot, imul, log, log10, log1p, log2, max, min, pow, random, round, sign, sin, sinh, sqrt, tan, tanh, trunc, E, LN10, LN2, LOG10E, LOG2E, PI, SQRT1_2, SQRT2. Received: {\\"_math.undefined\\":\\"X\\"} at locationId." `); }); @@ -17,7 +17,7 @@ test('_math invalid method or params', () => { test('_math invalid method', () => { expect(() => _math({ params: [1], methodName: 'X', location: 'locationId' })) .toThrowErrorMatchingInlineSnapshot(` - "Operator Error: _math.X is not supported, use one of the following types: abs, acos, acosh, asin, asinh, atan, atan2, atanh, cbrt, ceil, clz32, cos, cosh, exp, expm1, floor, fround, hypot, imul, log, log10, log1p, log2, max, min, pow, random, round, sign, sin, sinh, sqrt, tan, tanh, trunc, E, LN10, LN2, LOG10E, LOG2E, PI, SQRT1_2, SQRT2. + "Operator Error: _math.X is not supported, use one of the following: abs, acos, acosh, asin, asinh, atan, atan2, atanh, cbrt, ceil, clz32, cos, cosh, exp, expm1, floor, fround, hypot, imul, log, log10, log1p, log2, max, min, pow, random, round, sign, sin, sinh, sqrt, tan, tanh, trunc, E, LN10, LN2, LOG10E, LOG2E, PI, SQRT1_2, SQRT2. Received: {\\"_math.X\\":[1]} at locationId." `); }); diff --git a/packages/operators/test/common/mql.test.js b/packages/operators/test/common/mql.test.js index e176678a3..962a2947e 100644 --- a/packages/operators/test/common/mql.test.js +++ b/packages/operators/test/common/mql.test.js @@ -512,7 +512,7 @@ test('_mql invalid method name', () => { methodName: 'invalid', }) ).toThrowErrorMatchingInlineSnapshot(` - "Operator Error: _mql.invalid is not supported, use one of the following types: aggregate, expr, test. + "Operator Error: _mql.invalid is not supported, use one of the following: aggregate, expr, test. Received: {\\"_mql.invalid\\":{\\"on\\":{\\"number\\":42},\\"test\\":{\\"number\\":42}}} at locationId." `); }); @@ -527,7 +527,7 @@ test('_mql undefined method name', () => { location: 'locationId', }) ).toThrowErrorMatchingInlineSnapshot(` - "Operator Error: _mql requires a valid method name, use one of the following types: aggregate, expr, test. + "Operator Error: _mql requires a valid method name, use one of the following: aggregate, expr, test. Received: {\\"_mql.undefined\\":{\\"on\\":{\\"number\\":42},\\"test\\":{\\"number\\":42}}} at locationId." `); }); diff --git a/packages/operators/test/common/object.test.js b/packages/operators/test/common/object.test.js index 4a7cbb6c2..b8bb4b36e 100644 --- a/packages/operators/test/common/object.test.js +++ b/packages/operators/test/common/object.test.js @@ -215,7 +215,7 @@ describe('_object.assign', () => { test('_object called with no method or params', () => { expect(() => object({ location: 'locationId' })).toThrowErrorMatchingInlineSnapshot(` - "Operator Error: _object requires a valid method name, use one of the following types: keys, values, assign. + "Operator Error: _object requires a valid method name, use one of the following: keys, values, assign. Received: {\\"_object.undefined\\":undefined} at locationId." `); }); @@ -223,7 +223,7 @@ test('_object called with no method or params', () => { test('_object invalid method', () => { expect(() => object({ params: [{ a: 1 }], methodName: 'X', location: 'locationId' })) .toThrowErrorMatchingInlineSnapshot(` - "Operator Error: _object.X is not supported, use one of the following types: keys, values, assign. + "Operator Error: _object.X is not supported, use one of the following: keys, values, assign. Received: {\\"_object.X\\":[{\\"a\\":1}]} at locationId." `); }); @@ -231,7 +231,7 @@ test('_object invalid method', () => { test('_object invalid method args', () => { expect(() => object({ params: 'X', methodName: 'flat', location: 'locationId' })) .toThrowErrorMatchingInlineSnapshot(` - "Operator Error: _object.flat is not supported, use one of the following types: keys, values, assign. + "Operator Error: _object.flat is not supported, use one of the following: keys, values, assign. Received: {\\"_object.flat\\":\\"X\\"} at locationId." `); }); diff --git a/packages/operators/test/common/string.test.js b/packages/operators/test/common/string.test.js index 3cd3254bf..efb894018 100644 --- a/packages/operators/test/common/string.test.js +++ b/packages/operators/test/common/string.test.js @@ -1406,7 +1406,7 @@ describe('_string.length', () => { test('_string called with no method or params', () => { expect(() => string({ location: 'locationId' })).toThrowErrorMatchingInlineSnapshot(` - "Operator Error: _string.undefined is not supported, use one of the following types: charAt, concat, endsWith, includes, indexOf, lastIndexOf, match, normalize, padEnd, padStart, repeat, replace, search, slice, split, startsWith, substring, toLowerCase, toUpperCase, trim, trimEnd, trimStart, length. + "Operator Error: _string.undefined is not supported, use one of the following: charAt, concat, endsWith, includes, indexOf, lastIndexOf, match, normalize, padEnd, padStart, repeat, replace, search, slice, split, startsWith, substring, toLowerCase, toUpperCase, trim, trimEnd, trimStart, length. Received: {\\"_string.undefined\\":undefined} at locationId." `); }); @@ -1414,7 +1414,7 @@ test('_string called with no method or params', () => { test('_string invalid method', () => { expect(() => string({ params: ['a'], methodName: 'X', location: 'locationId' })) .toThrowErrorMatchingInlineSnapshot(` - "Operator Error: _string.X is not supported, use one of the following types: charAt, concat, endsWith, includes, indexOf, lastIndexOf, match, normalize, padEnd, padStart, repeat, replace, search, slice, split, startsWith, substring, toLowerCase, toUpperCase, trim, trimEnd, trimStart, length. + "Operator Error: _string.X is not supported, use one of the following: charAt, concat, endsWith, includes, indexOf, lastIndexOf, match, normalize, padEnd, padStart, repeat, replace, search, slice, split, startsWith, substring, toLowerCase, toUpperCase, trim, trimEnd, trimStart, length. Received: {\\"_string.X\\":[\\"a\\"]} at locationId." `); }); diff --git a/packages/operators/test/runClass.test.js b/packages/operators/test/runClass.test.js index 450605384..aabe87da6 100644 --- a/packages/operators/test/runClass.test.js +++ b/packages/operators/test/runClass.test.js @@ -279,7 +279,7 @@ test('calling an undefined function', () => { params: [], }) ).toThrowErrorMatchingInlineSnapshot(` - "Operator Error: _op.x is not supported, use one of the following types: singleArg, namedArgs, spreadArgs, nameAndSpread, noArgs, noArgsError, property, typeCheck, combination, error. + "Operator Error: _op.x is not supported, use one of the following: singleArg, namedArgs, spreadArgs, nameAndSpread, noArgs, noArgsError, property, typeCheck, combination, error. Received: {\\"_op.x\\":[]} at locationId." `); }); diff --git a/packages/operators/test/runInstance.test.js b/packages/operators/test/runInstance.test.js index 528ea5e87..68c666809 100644 --- a/packages/operators/test/runInstance.test.js +++ b/packages/operators/test/runInstance.test.js @@ -240,7 +240,7 @@ test('calling an undefined function', () => { instanceType: 'object', }) ).toThrowErrorMatchingInlineSnapshot(` - "Operator Error: _op.x is not supported, use one of the following types: singleArg, namedArgs, spreadArgs, nameAndSpread, property, typeCheck, combination, error, noFunction, returnInstance. + "Operator Error: _op.x is not supported, use one of the following: singleArg, namedArgs, spreadArgs, nameAndSpread, property, typeCheck, combination, error, noFunction, returnInstance. Received: {\\"_op.x\\":[]} at locationId." `); });