test: update tests for dench-to-crm rename and IDENTITY.md visibility

All test assertions updated to reference crm instead of dench, and IDENTITY.md is now expected to be visible in the workspace tree.
This commit is contained in:
kumarabhirup 2026-03-03 15:38:46 -08:00
parent 70ca59a66d
commit 72d5204e52
No known key found for this signature in database
GPG Key ID: DB7CA2289CAB0167
5 changed files with 38 additions and 38 deletions

View File

@ -103,7 +103,7 @@ describe("POST /api/workspace/init", () => {
expect(writeFileSync).toHaveBeenCalled();
});
it("seeds Dench skill into workspace/skills/dench/SKILL.md (not state dir)", async () => {
it("seeds CRM skill into workspace/skills/crm/SKILL.md (not state dir)", async () => {
const { existsSync, cpSync, mkdirSync } = await import("node:fs");
const workspace = await import("@/lib/workspace");
vi.mocked(workspace.discoverWorkspaces).mockReturnValue([]);
@ -112,7 +112,7 @@ describe("POST /api/workspace/init", () => {
vi.mocked(existsSync).mockImplementation((p) => {
const s = String(p);
if (s.endsWith("docs/reference/templates/AGENTS.md")) {return true;}
if (s.endsWith("skills/dench/SKILL.md")) {return true;}
if (s.endsWith("skills/crm/SKILL.md")) {return true;}
return false;
});
@ -120,13 +120,13 @@ describe("POST /api/workspace/init", () => {
expect(response.status).toBe(200);
const json = await response.json();
expect(json.denchSynced).toBe(true);
expect(json.crmSynced).toBe(true);
const cpSyncCalls = vi.mocked(cpSync).mock.calls;
const denchCopy = cpSyncCalls.find(
(call) => String(call[1]).includes(join(workspaceDir, "skills", "dench")),
const crmCopy = cpSyncCalls.find(
(call) => String(call[1]).includes(join(workspaceDir, "skills", "crm")),
);
expect(denchCopy).toBeTruthy();
expect(crmCopy).toBeTruthy();
const mkdirCalls = vi.mocked(mkdirSync).mock.calls;
const skillsMkdir = mkdirCalls.find(
@ -150,7 +150,7 @@ describe("POST /api/workspace/init", () => {
expect(response.status).toBe(200);
const workspaceDir = join(STATE_DIR, "workspace-work");
const expectedSkillPath = join(workspaceDir, "skills", "dench", "SKILL.md");
const expectedSkillPath = join(workspaceDir, "skills", "crm", "SKILL.md");
const identityWrites = vi.mocked(writeFileSync).mock.calls.filter(
(call) => String(call[0]).endsWith("IDENTITY.md"),
);

View File

@ -124,7 +124,7 @@ describe("Workspace Tree & Browse API", () => {
expect(json.workspaceRoot).toBe("/ws");
});
it("omits root IDENTITY.md from the workspace tree", async () => {
it("includes root IDENTITY.md in the workspace tree", async () => {
const { resolveWorkspaceRoot } = await import("@/lib/workspace");
vi.mocked(resolveWorkspaceRoot).mockReturnValue("/ws");
const { readdirSync: mockReaddir, existsSync: mockExists } = await import("node:fs");
@ -144,11 +144,11 @@ describe("Workspace Tree & Browse API", () => {
const res = await GET(req);
const json = await res.json();
const paths = (json.tree as Array<{ path: string }>).map((n) => n.path);
expect(paths).not.toContain("IDENTITY.md");
expect(paths).toContain("IDENTITY.md");
expect(paths).toContain("notes.md");
});
it("omits managed dench skill from the virtual skills folder", async () => {
it("omits managed crm skill from the virtual skills folder", async () => {
const { resolveWorkspaceRoot } = await import("@/lib/workspace");
vi.mocked(resolveWorkspaceRoot).mockReturnValue("/ws");
const { readdirSync: mockReaddir, existsSync: mockExists } = await import("node:fs");
@ -158,7 +158,7 @@ describe("Workspace Tree & Browse API", () => {
value === "/ws" ||
value === "/ws/skills" ||
value === "/ws/skills/alpha/SKILL.md" ||
value === "/ws/skills/dench/SKILL.md"
value === "/ws/skills/crm/SKILL.md"
);
});
vi.mocked(mockReaddir).mockImplementation((dir) => {
@ -168,7 +168,7 @@ describe("Workspace Tree & Browse API", () => {
if (String(dir) === "/ws/skills") {
return [
makeDirent("alpha", true),
makeDirent("dench", true),
makeDirent("crm", true),
] as unknown as Dirent[];
}
return [] as unknown as Dirent[];
@ -183,7 +183,7 @@ describe("Workspace Tree & Browse API", () => {
);
const skillPaths = (skillsFolder?.children ?? []).map((child) => child.path);
expect(skillPaths).toContain("~skills/alpha/SKILL.md");
expect(skillPaths).not.toContain("~skills/dench/SKILL.md");
expect(skillPaths).not.toContain("~skills/crm/SKILL.md");
});
});
@ -241,7 +241,7 @@ describe("Workspace Tree & Browse API", () => {
expect(json.items).toBeDefined();
});
it("omits root IDENTITY.md from sidebar file suggestions", async () => {
it("includes root IDENTITY.md in sidebar file suggestions", async () => {
const { resolveWorkspaceRoot } = await import("@/lib/workspace");
vi.mocked(resolveWorkspaceRoot).mockReturnValue("/ws");
const { existsSync: mockExists, readdirSync: mockReaddir } = await import("node:fs");
@ -263,7 +263,7 @@ describe("Workspace Tree & Browse API", () => {
const json = await res.json();
const names = (json.items as Array<{ name: string }>).map((item) => item.name);
expect(names).toContain("doc.md");
expect(names).not.toContain("IDENTITY.md");
expect(names).toContain("IDENTITY.md");
});
});

View File

@ -974,9 +974,9 @@ describe("workspace utilities", () => {
expect(isSystemFile("sub/workspace_context.yaml")).toBe(false);
});
it("returns true for IDENTITY.md at root", async () => {
it("returns false for IDENTITY.md (not a system file)", async () => {
const { isSystemFile } = await importWorkspace();
expect(isSystemFile("IDENTITY.md")).toBe(true);
expect(isSystemFile("IDENTITY.md")).toBe(false);
});
it("returns false for IDENTITY.md in subdirectory", async () => {

View File

@ -486,7 +486,7 @@ describe("bootstrapCommand always-onboard behavior", () => {
expect(readFileSync(workspaceDbPath, "utf-8")).toBe("existing-db-content");
const identityContent = readFileSync(identityPath, "utf-8");
expect(identityContent).toContain("You are **Ironclaw**");
expect(identityContent).toContain("~skills/dench/SKILL.md");
expect(identityContent).toContain("~skills/crm/SKILL.md");
expect(identityContent).not.toContain("# stale identity");
});
@ -530,17 +530,17 @@ describe("bootstrapCommand always-onboard behavior", () => {
expect(existsSync(identityPath)).toBe(true);
const identityContent = readFileSync(identityPath, "utf-8");
expect(identityContent).toContain("You are **Ironclaw**");
expect(identityContent).toContain("~skills/dench/SKILL.md");
expect(identityContent).toContain("~skills/crm/SKILL.md");
});
it("installs Dench skill into managed profile skills directory (keeps it out of editable workspace)", async () => {
it("installs CRM skill into managed profile skills directory (keeps it out of editable workspace)", async () => {
const runtime: RuntimeEnv = {
log: vi.fn(),
error: vi.fn(),
exit: vi.fn(),
};
const targetSkill = path.join(stateDir, "skills", "dench", "SKILL.md");
const workspaceSkill = path.join(stateDir, "workspace", "skills", "dench", "SKILL.md");
const targetSkill = path.join(stateDir, "skills", "crm", "SKILL.md");
const workspaceSkill = path.join(stateDir, "workspace", "skills", "crm", "SKILL.md");
expect(existsSync(targetSkill)).toBe(false);
await bootstrapCommand(
@ -557,16 +557,16 @@ describe("bootstrapCommand always-onboard behavior", () => {
expect(readFileSync(targetSkill, "utf-8")).toContain("name: database-crm-system");
});
it("replaces existing managed Dench skill on bootstrap (keeps updates in sync)", async () => {
it("replaces existing managed CRM skill on bootstrap (keeps updates in sync)", async () => {
const runtime: RuntimeEnv = {
log: vi.fn(),
error: vi.fn(),
exit: vi.fn(),
};
const targetDir = path.join(stateDir, "skills", "dench");
const targetDir = path.join(stateDir, "skills", "crm");
const targetSkill = path.join(targetDir, "SKILL.md");
mkdirSync(targetDir, { recursive: true });
writeFileSync(targetSkill, "name: dench\n# custom\n");
writeFileSync(targetSkill, "name: crm\n# custom\n");
await bootstrapCommand(
{
@ -622,7 +622,7 @@ describe("bootstrapCommand always-onboard behavior", () => {
expect(configuredWorkspace).not.toContain("workspace-ironclaw");
});
it("keeps Dench in managed skills even when workspace path is custom", async () => {
it("keeps CRM in managed skills even when workspace path is custom", async () => {
const runtime: RuntimeEnv = {
log: vi.fn(),
error: vi.fn(),
@ -641,8 +641,8 @@ describe("bootstrapCommand always-onboard behavior", () => {
gateway: { mode: "local" },
}),
);
const managedSkill = path.join(stateDir, "skills", "dench", "SKILL.md");
const workspaceSkill = path.join(customWorkspace, "skills", "dench", "SKILL.md");
const managedSkill = path.join(stateDir, "skills", "crm", "SKILL.md");
const workspaceSkill = path.join(customWorkspace, "skills", "crm", "SKILL.md");
await bootstrapCommand(
{
@ -655,7 +655,7 @@ describe("bootstrapCommand always-onboard behavior", () => {
expect(existsSync(managedSkill)).toBe(true);
expect(existsSync(workspaceSkill)).toBe(false);
const managedWorkspaceSkill = path.join(stateDir, "workspace", "skills", "dench", "SKILL.md");
const managedWorkspaceSkill = path.join(stateDir, "workspace", "skills", "crm", "SKILL.md");
expect(existsSync(managedWorkspaceSkill)).toBe(true);
});

View File

@ -16,13 +16,13 @@ function createTempDir(): string {
function createPackageRoot(tempDir: string): string {
const pkgRoot = path.join(tempDir, "pkg");
const seedDir = path.join(pkgRoot, "assets", "seed");
const skillsDir = path.join(pkgRoot, "skills", "dench");
const skillsDir = path.join(pkgRoot, "skills", "crm");
mkdirSync(seedDir, { recursive: true });
mkdirSync(skillsDir, { recursive: true });
writeFileSync(path.join(seedDir, "workspace.duckdb"), "SEED_DB_CONTENT", "utf-8");
writeFileSync(
path.join(skillsDir, "SKILL.md"),
"---\nname: database-crm-system\n---\n# Dench CRM\n",
"---\nname: database-crm-system\n---\n# CRM\n",
"utf-8",
);
return pkgRoot;
@ -39,17 +39,17 @@ describe("seedWorkspaceFromAssets", () => {
rmSync(tempDir, { recursive: true, force: true });
});
it("seeds Dench skill inside the workspace (not in state dir)", () => {
it("seeds CRM skill inside the workspace (not in state dir)", () => {
const packageRoot = createPackageRoot(tempDir);
const workspaceDir = path.join(tempDir, "workspace-main");
seedWorkspaceFromAssets({ workspaceDir, packageRoot });
const skillPath = path.join(workspaceDir, "skills", "dench", "SKILL.md");
const skillPath = path.join(workspaceDir, "skills", "crm", "SKILL.md");
expect(existsSync(skillPath)).toBe(true);
expect(readFileSync(skillPath, "utf-8")).toContain("database-crm-system");
const stateSkillPath = path.join(tempDir, "skills", "dench", "SKILL.md");
const stateSkillPath = path.join(tempDir, "skills", "crm", "SKILL.md");
expect(existsSync(stateSkillPath)).toBe(false);
});
@ -64,8 +64,8 @@ describe("seedWorkspaceFromAssets", () => {
const identityContent = readFileSync(identityPath, "utf-8");
expect(identityContent).toContain("Ironclaw");
expect(identityContent).toContain(path.join(workspaceDir, "skills", "dench", "SKILL.md"));
expect(identityContent).not.toContain("~skills/dench/SKILL.md");
expect(identityContent).toContain(path.join(workspaceDir, "skills", "crm", "SKILL.md"));
expect(identityContent).not.toContain("~skills/crm/SKILL.md");
});
it("IDENTITY.md references Ironclaw system prompt contract", () => {
@ -119,13 +119,13 @@ describe("seedWorkspaceFromAssets", () => {
expect(identityContent).not.toContain("# stale identity");
});
it("includes skills/dench/SKILL.md in projection files list", () => {
it("includes skills/crm/SKILL.md in projection files list", () => {
const packageRoot = createPackageRoot(tempDir);
const workspaceDir = path.join(tempDir, "workspace-list");
const result = seedWorkspaceFromAssets({ workspaceDir, packageRoot });
expect(result.projectionFiles).toContain("skills/dench/SKILL.md");
expect(result.projectionFiles).toContain("skills/crm/SKILL.md");
expect(result.projectionFiles).toContain("IDENTITY.md");
});
});