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('unknown input topic does not throw and still calls done', 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() {} }, updateState() {}, }; inst._commands = createRegistry(commands, { logger: inst.source.logger }); inst._attachInputHandler(); let doneCalled = 0; await assert.doesNotReject(async () => { await node._handlers.input({ topic: 'somethingUnknown', payload: 1 }, () => {}, () => { doneCalled += 1; }); }); assert.equal(doneCalled, 1); });