feat(web): add orchestrator readiness badge and resilient events parsing
All checks were successful
ci/woodpecker/push/web Pipeline was successful
All checks were successful
ci/woodpecker/push/web Pipeline was successful
This commit is contained in:
@@ -24,25 +24,37 @@ describe("OrchestratorEventsWidget", () => {
|
||||
});
|
||||
|
||||
it("renders events and matrix signal count", async () => {
|
||||
mockFetch.mockResolvedValue({
|
||||
ok: true,
|
||||
json: () =>
|
||||
Promise.resolve({
|
||||
events: [
|
||||
{
|
||||
type: "task.completed",
|
||||
timestamp: "2026-02-17T16:40:00.000Z",
|
||||
taskId: "TASK-1",
|
||||
data: { channelId: "room-123" },
|
||||
},
|
||||
{
|
||||
type: "agent.running",
|
||||
timestamp: "2026-02-17T16:41:00.000Z",
|
||||
taskId: "TASK-2",
|
||||
agentId: "agent-abc12345",
|
||||
},
|
||||
],
|
||||
}),
|
||||
mockFetch.mockImplementation((input: RequestInfo | URL) => {
|
||||
const url =
|
||||
typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
||||
|
||||
if (url.includes("/api/orchestrator/health")) {
|
||||
return Promise.resolve({
|
||||
ok: true,
|
||||
json: () => Promise.resolve({ status: "ok" }),
|
||||
} as unknown as Response);
|
||||
}
|
||||
|
||||
return Promise.resolve({
|
||||
ok: true,
|
||||
json: () =>
|
||||
Promise.resolve({
|
||||
events: [
|
||||
{
|
||||
type: "task.completed",
|
||||
timestamp: "2026-02-17T16:40:00.000Z",
|
||||
taskId: "TASK-1",
|
||||
data: { channelId: "room-123" },
|
||||
},
|
||||
{
|
||||
type: "agent.running",
|
||||
timestamp: "2026-02-17T16:41:00.000Z",
|
||||
taskId: "TASK-2",
|
||||
agentId: "agent-abc12345",
|
||||
},
|
||||
],
|
||||
}),
|
||||
} as unknown as Response);
|
||||
});
|
||||
|
||||
render(<OrchestratorEventsWidget id="orchestrator-events-1" config={{}} />);
|
||||
@@ -51,6 +63,7 @@ describe("OrchestratorEventsWidget", () => {
|
||||
expect(screen.getByText("task.completed")).toBeInTheDocument();
|
||||
expect(screen.getByText("agent.running")).toBeInTheDocument();
|
||||
expect(screen.getByText(/Matrix signals: 1/)).toBeInTheDocument();
|
||||
expect(screen.getByText("ready")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user