Files
reactor/test/edge/missing-child.edge.test.js

30 lines
1003 B
JavaScript
Raw Normal View History

2026-02-19 17:37:42 +01:00
const test = require('node:test');
const assert = require('node:assert/strict');
const NodeClass = require('../../src/nodeClass');
const commands = require('../../src/commands');
const { createRegistry } = require('generalFunctions');
2026-02-19 17:37:42 +01:00
const { makeNodeStub, makeREDStub } = require('../helpers/factories');
test('registerChild with unknown node id is ignored without throwing', async () => {
2026-02-19 17:37:42 +01:00
const inst = Object.create(NodeClass.prototype);
const node = makeNodeStub();
inst.node = node;
inst.RED = makeREDStub();
inst.source = {
logger: { warn: () => {}, info: () => {}, debug: () => {}, error: () => {} },
childRegistrationUtils: { registerChild() {} },
2026-02-19 17:37:42 +01:00
};
inst._commands = createRegistry(commands, { logger: inst.source.logger });
2026-02-19 17:37:42 +01:00
inst._attachInputHandler();
await assert.doesNotReject(async () => {
await node._handlers.input(
2026-02-19 17:37:42 +01:00
{ topic: 'registerChild', payload: 'missing-child', positionVsParent: 'upstream' },
() => {},
() => {},
);
});
});