Files
paseo/packages/app/src/utils/sidebar-agent-state.test.ts
T
Mohamed Boudra 8a9d738438 Fix sync loader spinner showing for initializing (non-running) agents
Initializing agents were mapped to the "running" bucket in both server
and client, causing the SyncedLoader spinner to appear in tabs and
sidebar workspace rows when opening an agent for the first time.
2026-04-10 11:13:14 +07:00

49 lines
1.2 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { deriveSidebarStateBucket } from "./sidebar-agent-state";
describe("deriveSidebarStateBucket", () => {
it("prioritizes pending permissions as needs_input", () => {
expect(
deriveSidebarStateBucket({
status: "idle",
pendingPermissionCount: 1,
requiresAttention: false,
attentionReason: null,
}),
).toBe("needs_input");
});
it("keeps legacy permission attention in needs_input", () => {
expect(
deriveSidebarStateBucket({
status: "idle",
pendingPermissionCount: 0,
requiresAttention: true,
attentionReason: "permission",
}),
).toBe("needs_input");
});
it("treats unread finished agents as attention", () => {
expect(
deriveSidebarStateBucket({
status: "idle",
pendingPermissionCount: 0,
requiresAttention: true,
attentionReason: "finished",
}),
).toBe("attention");
});
it("treats initializing agents as done", () => {
expect(
deriveSidebarStateBucket({
status: "initializing",
pendingPermissionCount: 0,
requiresAttention: false,
attentionReason: null,
}),
).toBe("done");
});
});