fix: stop completed live runs from appearing active
This commit is contained in:
@@ -38,6 +38,28 @@ describe("usePresentationTargetStatus", () => {
|
||||
expect(result.current.liveTargetReady).toBe(true);
|
||||
});
|
||||
|
||||
it("does not label a completed live run as active", async () => {
|
||||
mockedCallOperation.mockResolvedValue({
|
||||
ok: true as const,
|
||||
operation: "workflow.health",
|
||||
label: "Health",
|
||||
interpreted: { status: "ok", storeRoot: "store" },
|
||||
exchange: { request: {}, response: {} },
|
||||
equivalentCli: "uv run wf status",
|
||||
durationMs: 2,
|
||||
});
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
usePresentationTargetStatus(target, {
|
||||
...initialDemoTimelineState,
|
||||
phase: "completed",
|
||||
}),
|
||||
);
|
||||
|
||||
await waitFor(() => expect(result.current.status.kind).toBe("ready"));
|
||||
expect(result.current.status.label).toBe("Live target ready");
|
||||
});
|
||||
|
||||
it("falls back to replay when health fails", async () => {
|
||||
mockedCallOperation.mockResolvedValue({
|
||||
ok: false as const,
|
||||
|
||||
@@ -15,7 +15,7 @@ export type PresentationTargetStatusController = {
|
||||
};
|
||||
|
||||
const liveActive = (state: DemoTimelineState): boolean =>
|
||||
state.mode === "live" && state.phase !== "ready";
|
||||
state.mode === "live" && ["running", "paused", "review"].includes(state.phase);
|
||||
|
||||
export const usePresentationTargetStatus = (
|
||||
targetState: PresentationTargetState,
|
||||
|
||||
Reference in New Issue
Block a user