mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 11:25:50 -06:00
65e12328aa
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
23 lines
1.1 KiB
TypeScript
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);
|
|
});
|
|
});
|