feat: implement real-time dashboard updates via WebSockets
This commit is contained in:
@@ -153,4 +153,33 @@ describe("dashboardService", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("recordEvent", () => {
|
||||
test("should emit NEW_EVENT to systemEvents", async () => {
|
||||
const mockEmit = mock(() => { });
|
||||
|
||||
mock.module("@shared/lib/events", () => ({
|
||||
systemEvents: {
|
||||
emit: mockEmit,
|
||||
},
|
||||
EVENTS: {
|
||||
DASHBOARD: {
|
||||
NEW_EVENT: "dashboard:new_event",
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
await dashboardService.recordEvent({
|
||||
type: 'info',
|
||||
message: 'Test Event',
|
||||
icon: '🚀'
|
||||
});
|
||||
|
||||
expect(mockEmit).toHaveBeenCalled();
|
||||
const [eventName, data] = mockEmit.mock.calls[0] as any;
|
||||
expect(eventName).toBe("dashboard:new_event");
|
||||
expect(data.message).toBe("Test Event");
|
||||
expect(data.timestamp).toBeDefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user