Refactor of reactor to use BaseNodeAdapter + commandRegistry + statusBadge. reactor follows the platform refactor plan in .claude/refactor/MODULE_SPLIT.md. Tests stay green; CONTRACT.md generated; legacy aliases preserved. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
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);
|
|
});
|