import { describe, expect, it } from "vitest";

import { findWorkspace, workspaceGroups, workspaces } from "./workspaceRegistry";

describe("workspace registry", () => {
  it("contains the sixteen ordered product workspaces without duplicate routes", () => {
    expect(workspaces).toHaveLength(16);
    expect(workspaces[0]?.key).toBe("emotion");
    expect(workspaces.at(-1)?.key).toBe("review");
    expect(new Set(workspaces.map((item) => item.key)).size).toBe(16);
    expect(workspaceGroups).toEqual(["市场复盘", "智能工具", "个人"]);
  });

  it("resolves registered workspaces only", () => {
    expect(findWorkspace("heaven")?.title).toBe("问天");
    expect(findWorkspace("unknown")).toBeUndefined();
  });
});
