test: tighten claude migration assertions

This commit is contained in:
Peter Steinberger
2026-05-11 02:29:32 +01:00
parent 3c13dedfae
commit 57d587dd61

View File

@@ -13,6 +13,17 @@ import {
writeFile,
} from "./test/provider-helpers.js";
function planItemById(
items: readonly { id: string; kind?: string; action?: string }[],
id: string,
) {
const item = items.find((candidate) => candidate.id === id);
if (!item) {
throw new Error(`expected migration plan item ${id}`);
}
return item;
}
describe("Claude migration provider", () => {
afterEach(async () => {
await cleanupTempRoots();
@@ -86,20 +97,16 @@ describe("Claude migration provider", () => {
);
expect(plan.summary.total).toBeGreaterThan(0);
expect(plan.items).toEqual(
expect.arrayContaining([
expect.objectContaining({ id: "workspace:CLAUDE.md", kind: "workspace" }),
expect.objectContaining({
id: "config:mcp-server:project-mcp:filesystem",
kind: "config",
}),
expect.objectContaining({ id: "skill:claude-command-commit", action: "create" }),
expect.objectContaining({ id: "skill:review", action: "copy" }),
expect.objectContaining({ id: "archive:CLAUDE.local.md", action: "archive" }),
expect.objectContaining({ id: "archive:project-agents", action: "archive" }),
expect.objectContaining({ id: expect.stringMatching(/^manual:hooks:/u), kind: "manual" }),
]),
expect(planItemById(plan.items, "workspace:CLAUDE.md").kind).toBe("workspace");
expect(planItemById(plan.items, "config:mcp-server:project-mcp:filesystem").kind).toBe(
"config",
);
expect(planItemById(plan.items, "skill:claude-command-commit").action).toBe("create");
expect(planItemById(plan.items, "skill:review").action).toBe("copy");
expect(planItemById(plan.items, "archive:CLAUDE.local.md").action).toBe("archive");
expect(planItemById(plan.items, "archive:project-agents").action).toBe("archive");
const manualHooksItem = plan.items.find((item) => item.id.startsWith("manual:hooks:"));
expect(manualHooksItem?.kind).toBe("manual");
const redacted = JSON.stringify(redactMigrationPlan(plan));
expect(redacted).not.toContain("short-dev-key");