Files
openclaw/ui/src/lib/session-run-state.test.ts
T
Shakker 65e12328aa feat: refactor the Control UI architecture
Refactor the Control UI around route-owned page lifecycle and state while preserving existing behavior and design.

Prepared head SHA: bd51b6fa76
Co-authored-by: Shakker <165377636+shakkernerd@users.noreply.github.com>
Reviewed-by: @shakkernerd
2026-07-04 23:19:38 +01:00

23 lines
1.1 KiB
TypeScript

// Control UI tests cover session run state behavior.
import { describe, expect, it } from "vitest";
import { isSessionRunActive } from "./session-run-state.ts";
describe("isSessionRunActive", () => {
it("uses explicit live-run state over stale running status", () => {
expect(isSessionRunActive({ status: "running", hasActiveRun: false })).toBe(false);
expect(isSessionRunActive({ status: "running", hasActiveRun: true })).toBe(true);
});
it("keeps terminal status authoritative over stale active flags", () => {
expect(isSessionRunActive({ status: "done", hasActiveRun: true })).toBe(false);
expect(isSessionRunActive({ status: "failed", hasActiveRun: true })).toBe(false);
expect(isSessionRunActive({ status: "killed", hasActiveRun: true })).toBe(false);
expect(isSessionRunActive({ status: "timeout", hasActiveRun: true })).toBe(false);
});
it("keeps legacy running status active when no live-run flag exists", () => {
expect(isSessionRunActive({ status: "running" })).toBe(true);
expect(isSessionRunActive({ hasActiveRun: true })).toBe(true);
});
});