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:
@@ -4,28 +4,21 @@ const assert = require('node:assert/strict');
|
||||
const NodeClass = require('../../src/nodeClass');
|
||||
const { makeNodeStub } = require('../helpers/factories');
|
||||
|
||||
test('_registerChild emits delayed registration message on output 2', () => {
|
||||
// Post-refactor: BaseNodeAdapter handles registration via _scheduleRegistration
|
||||
// (was _registerChild). Topic moved from 'registerChild' to 'child.register'.
|
||||
test('_scheduleRegistration emits delayed child.register message on output 2', () => {
|
||||
const inst = Object.create(NodeClass.prototype);
|
||||
const node = makeNodeStub();
|
||||
|
||||
inst.node = node;
|
||||
inst.config = {
|
||||
functionality: {
|
||||
positionVsParent: 'downstream',
|
||||
},
|
||||
};
|
||||
inst.config = { functionality: { positionVsParent: 'downstream', distance: null } };
|
||||
|
||||
const originalSetTimeout = global.setTimeout;
|
||||
const delays = [];
|
||||
|
||||
global.setTimeout = (fn, ms) => {
|
||||
delays.push(ms);
|
||||
fn();
|
||||
return 1;
|
||||
};
|
||||
global.setTimeout = (fn, ms) => { delays.push(ms); fn(); return 1; };
|
||||
|
||||
try {
|
||||
inst._registerChild();
|
||||
inst._scheduleRegistration();
|
||||
} finally {
|
||||
global.setTimeout = originalSetTimeout;
|
||||
}
|
||||
@@ -33,7 +26,7 @@ test('_registerChild emits delayed registration message on output 2', () => {
|
||||
assert.deepEqual(delays, [100]);
|
||||
assert.equal(node._sent.length, 1);
|
||||
assert.equal(Array.isArray(node._sent[0]), true);
|
||||
assert.equal(node._sent[0][2].topic, 'registerChild');
|
||||
assert.equal(node._sent[0][2].topic, 'child.register');
|
||||
assert.equal(node._sent[0][2].payload, node.id);
|
||||
assert.equal(node._sent[0][2].positionVsParent, 'downstream');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user