From 72d5204e52f6d84cff5ce80cbe98b465f16688b6 Mon Sep 17 00:00:00 2001 From: kumarabhirup Date: Tue, 3 Mar 2026 15:38:46 -0800 Subject: [PATCH] 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. --- apps/web/app/api/workspace/init/route.test.ts | 14 +++++------ .../web/app/api/workspace/tree-browse.test.ts | 16 ++++++------- apps/web/lib/workspace.test.ts | 4 ++-- ...otstrap-external.bootstrap-command.test.ts | 24 +++++++++---------- src/cli/workspace-seed.test.ts | 18 +++++++------- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/apps/web/app/api/workspace/init/route.test.ts b/apps/web/app/api/workspace/init/route.test.ts index 5ac783e3784..9090df75864 100644 --- a/apps/web/app/api/workspace/init/route.test.ts +++ b/apps/web/app/api/workspace/init/route.test.ts @@ -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"), ); diff --git a/apps/web/app/api/workspace/tree-browse.test.ts b/apps/web/app/api/workspace/tree-browse.test.ts index 564aa88580a..083fd6cb9b9 100644 --- a/apps/web/app/api/workspace/tree-browse.test.ts +++ b/apps/web/app/api/workspace/tree-browse.test.ts @@ -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"); }); }); diff --git a/apps/web/lib/workspace.test.ts b/apps/web/lib/workspace.test.ts index c7d0c0ebe43..af76fe2d609 100644 --- a/apps/web/lib/workspace.test.ts +++ b/apps/web/lib/workspace.test.ts @@ -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 () => { diff --git a/src/cli/bootstrap-external.bootstrap-command.test.ts b/src/cli/bootstrap-external.bootstrap-command.test.ts index bf9cb8639da..6cf77bf6afd 100644 --- a/src/cli/bootstrap-external.bootstrap-command.test.ts +++ b/src/cli/bootstrap-external.bootstrap-command.test.ts @@ -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); }); diff --git a/src/cli/workspace-seed.test.ts b/src/cli/workspace-seed.test.ts index 05f59199cf9..51a0e65aa62 100644 --- a/src/cli/workspace-seed.test.ts +++ b/src/cli/workspace-seed.test.ts @@ -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"); }); });