mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-02-23 14:39:32 +08:00
fix: Update error message for unsupported method.
This commit is contained in:
parent
38af83b3fc
commit
285a6cb928
@ -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}.`
|
||||
|
@ -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."
|
||||
`);
|
||||
});
|
||||
|
@ -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."
|
||||
`);
|
||||
});
|
||||
|
@ -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."
|
||||
`);
|
||||
});
|
||||
|
@ -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."
|
||||
`);
|
||||
});
|
||||
|
@ -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."
|
||||
`);
|
||||
});
|
||||
|
@ -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."
|
||||
`);
|
||||
});
|
||||
|
@ -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."
|
||||
`);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user