AkurAI Build
Menu

popagent

public

Latest change b2dc8f2ef5aa485d2f203d8b0f3778610038bfd1 - refactor: streamline overview and schedules by AkurAI Build

import { describe, expect, test } from "bun:test";
import { renderToStaticMarkup } from "react-dom/server";
import { TaskRemoveDialog, WorkspaceChatDeleteDialog, WorkspaceOverview } from "./WorkspaceOverview";

describe("WorkspaceChatDeleteDialog", () => {
  test("confirms permanent deletion of active and archived workspace chats", () => {
    const html = renderToStaticMarkup(<WorkspaceChatDeleteDialog
      workspace={{ id: "docs", name: "Docs", repositoryPath: "docs", createdAt: "", updatedAt: "" }}
      deleting={false}
      error=""
      onCancel={() => {}}
      onDelete={() => {}}
    />);

    expect(html).toContain("Delete all chats in “Docs”?");
    expect(html).toContain("active and archived chats");
    expect(html).toContain("Independent long-term memories are retained");
  });
});

test("warns before permanently removing task history", () => {
  const html = renderToStaticMarkup(<TaskRemoveDialog
    task={{ id: "failed", sessionId: null, scheduleId: null, source: "user", workspaceId: "mail", prompt: "Failed task evidence", model: "test/model", status: "failed", output: null, error: "failed", stepsCompleted: 1, progress: null, recoveryCount: 0, attemptCount: 1, maxAttempts: 3, nextAttemptAt: null, lastErrorClass: "unknown", deadLetteredAt: null, createdAt: "", startedAt: "", completedAt: "" }}
    removing={false}
    onCancel={() => {}}
    onRemove={() => {}}
  />);
  expect(html).toContain('role="alertdialog"');
  expect(html).toContain("permanently removes the task history and evidence");
  expect(html).toContain("Remove task");
});

test("organizes the root around operational status, live work, and repositories", () => {
  const html = renderToStaticMarkup(<WorkspaceOverview
    workspaces={[{ id: "mail", name: "AkurAI-Mail", repositoryPath: "AkurAI-Mail", createdAt: "", updatedAt: "" }]}
    sessions={[]}
    tasks={[{
      id: "mail-task",
      sessionId: null,
      scheduleId: null,
      source: "user",
      workspaceId: "mail",
      prompt: "Configure mail clients",
      model: "cx/gpt-5.6-sol",
      status: "running",
      output: null,
      error: null,
      stepsCompleted: 4,
      progress: "Reviewer checking TLS",
      recoveryCount: 0,
      attemptCount: 1,
      maxAttempts: 3,
      nextAttemptAt: null,
      lastErrorClass: null,
      deadLetteredAt: null,
      createdAt: "2026-08-14T18:16:51.000Z",
      startedAt: "2026-08-14T18:16:52.000Z",
      completedAt: null,
    }]}
    taskStepLimit={24}
    onCreateTask={async () => true}
    onCancelTask={() => {}}
    onRemoveTask={async () => true}
    onOpen={() => {}}
    onManage={() => {}}
    onOpenNavigation={() => {}}
  />);

  expect(html).toContain("Live work");
  expect(html).toContain("Repositories");
  expect(html).not.toContain("Operations");
  expect(html).not.toContain("Fusion direction");
  expect(html).not.toContain("Local build crew");
  expect(html).toContain('aria-haspopup="dialog"');
  expect(html).toContain('aria-label="1 task running"');
  expect(html).toContain('aria-label="0 tasks needing attention"');
  expect(html).not.toContain('aria-label="Task prompt"');
  expect(html).toContain("AkurAI-Mail");
  expect(html).toContain("Reviewer checking TLS");
  expect(html).toContain("4 of 24 steps");
});