feat(web): share realtime hub across domain events
This commit is contained in:
1 parent
66a1146562
commit
a51e0b6b31
2 files changed
+26
-1
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { LogBroadcaster } from '../../src/web/log-broadcaster.js';
|
||||
import { RealtimeEventHub } from '../../src/web/events/index.js';
|
||||
|
||||
describe('dashboard event wiring', () => {
|
||||
it('publishes domain and log events through the same ordered hub', () => {
|
||||
const hub = new RealtimeEventHub({ capacity: 20 });
|
||||
const broadcaster = new LogBroadcaster(hub);
|
||||
const received: string[] = [];
|
||||
const subscription = hub.subscribe((event) => received.push(event.type));
|
||||
|
||||
broadcaster.dashboardEvents.bot({ running: true, dryRun: false });
|
||||
broadcaster.push('info', 'Bot started');
|
||||
|
||||
expect(received).toEqual(['bot.status.changed', 'log.created']);
|
||||
subscription.unsubscribe();
|
||||
broadcaster.closeAll();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user