20 lines
776 B
TypeScript
20 lines
776 B
TypeScript
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();
|
|
});
|
|
});
|