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'); const { makeNodeStub, makeREDStub } = require('../helpers/factories'); test('registerChild with unknown node id is ignored without throwing', async () => { const inst = Object.create(NodeClass.prototype); const node = makeNodeStub(); inst.node = node; inst.RED = makeREDStub(); inst.source = { logger: { warn: () => {}, info: () => {}, debug: () => {}, error: () => {} }, childRegistrationUtils: { registerChild() {} }, }; inst._commands = createRegistry(commands, { logger: inst.source.logger }); inst._attachInputHandler(); await assert.doesNotReject(async () => { await node._handlers.input( { topic: 'registerChild', payload: 'missing-child', positionVsParent: 'upstream' }, () => {}, () => {}, ); }); });