chore: More tests for Workflow.ts (#13349)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-02-19 15:44:39 +01:00
committed by GitHub
parent 81282bd5c0
commit 1d03c2c8ca
4 changed files with 859 additions and 355 deletions

View File

@@ -458,7 +458,6 @@ export class Workflow {
*/
getHighestNode(
nodeName: string,
type: NodeConnectionType = NodeConnectionType.Main,
nodeConnectionIndex?: number,
checkedNodes?: string[],
): string[] {
@@ -473,7 +472,7 @@ export class Workflow {
return currentHighest;
}
if (!this.connectionsByDestinationNode[nodeName].hasOwnProperty(type)) {
if (!this.connectionsByDestinationNode[nodeName].hasOwnProperty(NodeConnectionType.Main)) {
// Node does not have incoming connections of given type
return currentHighest;
}
@@ -493,14 +492,15 @@ export class Workflow {
let connectionsByIndex: IConnection[] | null;
for (
let connectionIndex = 0;
connectionIndex < this.connectionsByDestinationNode[nodeName][type].length;
connectionIndex < this.connectionsByDestinationNode[nodeName][NodeConnectionType.Main].length;
connectionIndex++
) {
if (nodeConnectionIndex !== undefined && nodeConnectionIndex !== connectionIndex) {
// If a connection-index is given ignore all other ones
continue;
}
connectionsByIndex = this.connectionsByDestinationNode[nodeName][type][connectionIndex];
connectionsByIndex =
this.connectionsByDestinationNode[nodeName][NodeConnectionType.Main][connectionIndex];
// eslint-disable-next-line @typescript-eslint/no-loop-func
connectionsByIndex?.forEach((connection) => {
if (checkedNodes.includes(connection.node)) {
@@ -508,7 +508,7 @@ export class Workflow {
return;
}
addNodes = this.getHighestNode(connection.node, type, undefined, checkedNodes);
addNodes = this.getHighestNode(connection.node, undefined, checkedNodes);
if (addNodes.length === 0) {
// The checked node does not have any further parents so add it