Fixed failing tests and action engine props

This commit is contained in:
Thaum Rystra
2024-02-22 09:11:00 +02:00
parent b41d26b3ad
commit 5141704e23
18 changed files with 181 additions and 140 deletions

View File

@@ -11,4 +11,10 @@ describe('Call Node', function () {
assert.isEmpty(context.errors)
assert.equal(toString(result), 'min(unknownVariable, 3, 3d30)');
});
it('reduces', async function () {
const callNode = parse('min( unknownVariable, 1 + 2, 3d30 )');
const { result, context } = await resolve('reduce', callNode, undefined, undefined, inputProviderForTests);
assert.isEmpty(context.errors)
assert.equal(toString(result), '0');
});
});

View File

@@ -173,16 +173,13 @@ const call: CallFactory = {
expectedType = argumentsExpected[index];
}
if (expectedType === 'parseNode') return;
if (
node.parseType !== expectedType
|| (
node.parseType === 'constant'
&& node.valueType !== expectedType
)
) failed = true;
failed = !(
node.parseType === expectedType
|| (node.parseType === 'constant' && node.valueType === expectedType)
);
if (failed && fn === 'reduce') {
const typeName = typeof expectedType === 'string' ? expectedType : expectedType.constructor.name;
const nodeName = node.parseType;
const nodeName = node.parseType === 'constant' ? node.valueType : node.parseType;
context.error(`Incorrect arguments to ${callNode.functionName} function` +
`expected ${typeName} got ${nodeName}`);
}