Skip to content

The platform for continuously improving AI agents.

1.5 KB
Raw Blame
// covers: home-setup
import { describe, expect, it } from "vitest";

import { quickstartStage } from "./home-quickstart";

const done = { dataset: true, deployed: true, evalSet: true, scanned: true, trained: true };
const loaded = { activityLoading: false, error: false, milestonesLoading: false };

describe("quickstartStage", () => {
  it("shows nothing until the setup answers, then one stage that stays", () => {
    expect(quickstartStage({ ...loaded, setup: undefined })).toBe("pending");
    // A finished setup never passes through the checklist on a reload.
    expect(quickstartStage({ ...loaded, activityLoading: true, setup: done })).toBe("pending");
    expect(quickstartStage({ ...loaded, setup: done })).toBe("suggestions");
  });

  it("shows the checklist while a step is left and the install prompt before a scan", () => {
    expect(quickstartStage({ ...loaded, setup: { ...done, trained: false } })).toBe("guide");
    const unscanned = { ...done, scanned: false };
    expect(quickstartStage({ ...loaded, milestonesLoading: true, setup: unscanned })).toBe(
      "pending"
    );
    expect(quickstartStage({ ...loaded, setup: unscanned })).toBe("install");
  });

  it("says the status is unavailable when the setup read fails", () => {
    expect(quickstartStage({ ...loaded, error: true, setup: undefined })).toBe("error");
    // A failed background poll keeps the stage already shown.
    expect(quickstartStage({ ...loaded, error: true, setup: done })).toBe("suggestions");
  });
});