Fix unit tests

pull/5329/head
GogoVega 2025-10-29 14:42:40 +01:00
parent cee3fd8395
commit c2bd5053cf
No known key found for this signature in database
GPG Key ID: E1E048B63AC5AC2B
2 changed files with 2 additions and 3 deletions

View File

@ -632,7 +632,7 @@ class Flow {
}
} else {
const candidateNodes = [];
const isConfigNode = !!node._flow.flow.configs[node.id];
const isConfigNode = !!node._flow?.flow.configs[node.id];
this.catchNodes.forEach(targetCatchNode => {
if (msg === null && !targetCatchNode.anyError) {
// Skip if the catch node only accepts errors produced by message processing

View File

@ -69,8 +69,7 @@ describe('function node', function() {
});
it('should do something with the catch node', function(done) {
// TODO: global flow should not contain these nodes
var flow = [{"id":"flow","type":"tab"},{"id":"funcNode","type":"function","wires":[["goodNode"]],"func":"node.error('This is an error', msg);","z":"flow"},{"id":"goodNode","type":"helper","z":"flow"},{"id":"badNode","type":"helper","z":"flow"},{"id":"catchNode","type":"catch","scope":null,"uncaught":false,"wires":[["badNode"]],"anyError":true,"includeConfig":true,"z":"flow"}];
var flow = [{"id":"flow","type":"tab"},{"id":"funcNode","type":"function","wires":[["goodNode"]],"func":"node.error('This is an error', msg);","x":0,"y":0,"z":"flow"},{"id":"goodNode","type":"helper","z":"flow"},{"id":"badNode","type":"helper","z":"flow"},{"id":"catchNode","type":"catch","scope":null,"uncaught":false,"wires":[["badNode"]],"z":"flow"}];
var catchNodeModule = require("nr-test-utils").require("@node-red/nodes/core/common/25-catch.js")
helper.load([catchNodeModule, functionNode], flow, function() {
var funcNode = helper.getNode("funcNode");