mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2026-09-26 19:51:42 +02:00
fix(core): Don't fail partial execution when an unrelated node is dirty (#13925)
This commit is contained in:
+31
@@ -492,4 +492,35 @@ describe('DirectedGraph', () => {
|
||||
expect(graph.hasNode(node.name + 'foo')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getNodesByNames', () => {
|
||||
test('returns empty Set when no names are provided', () => {
|
||||
// ARRANGE
|
||||
const node1 = createNodeData({ name: 'Node1' });
|
||||
const node2 = createNodeData({ name: 'Node2' });
|
||||
const graph = new DirectedGraph().addNodes(node1, node2);
|
||||
|
||||
// ACT
|
||||
const result = graph.getNodesByNames([]);
|
||||
|
||||
// ASSERT
|
||||
expect(result.size).toBe(0);
|
||||
expect(result).toEqual(new Set());
|
||||
});
|
||||
|
||||
test('returns Set with only nodes that exist in the graph', () => {
|
||||
// ARRANGE
|
||||
const node1 = createNodeData({ name: 'Node1' });
|
||||
const node2 = createNodeData({ name: 'Node2' });
|
||||
const node3 = createNodeData({ name: 'Node3' });
|
||||
const graph = new DirectedGraph().addNodes(node1, node2, node3);
|
||||
|
||||
// ACT
|
||||
const result = graph.getNodesByNames(['Node1', 'Node3', 'Node4']);
|
||||
|
||||
// ASSERT
|
||||
expect(result.size).toBe(2);
|
||||
expect(result).toEqual(new Set([node1, node3]));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -50,6 +50,25 @@ export class DirectedGraph {
|
||||
return new Map(this.nodes.entries());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a set of nodes whose names match the provided array of names.
|
||||
*
|
||||
* Only nodes that exist in the graph will be included in the result.
|
||||
*/
|
||||
getNodesByNames(names: string[]) {
|
||||
const nodes: Set<INode> = new Set();
|
||||
|
||||
for (const name of names) {
|
||||
const node = this.nodes.get(name);
|
||||
|
||||
if (node) {
|
||||
nodes.add(node);
|
||||
}
|
||||
}
|
||||
|
||||
return nodes;
|
||||
}
|
||||
|
||||
getConnections(filter: { to?: INode } = {}) {
|
||||
const filteredCopy: GraphConnection[] = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user