P6: convert reactor to platform infrastructure
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>
This commit is contained in:
@@ -2,24 +2,25 @@ 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', () => {
|
||||
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 = {
|
||||
childRegistrationUtils: {
|
||||
registerChild() {},
|
||||
},
|
||||
logger: { warn: () => {}, info: () => {}, debug: () => {}, error: () => {} },
|
||||
childRegistrationUtils: { registerChild() {} },
|
||||
};
|
||||
|
||||
inst._commands = createRegistry(commands, { logger: inst.source.logger });
|
||||
inst._attachInputHandler();
|
||||
|
||||
assert.doesNotThrow(() => {
|
||||
node._handlers.input(
|
||||
await assert.doesNotReject(async () => {
|
||||
await node._handlers.input(
|
||||
{ topic: 'registerChild', payload: 'missing-child', positionVsParent: 'upstream' },
|
||||
() => {},
|
||||
() => {},
|
||||
|
||||
Reference in New Issue
Block a user