test: 更新 adapter 测试适配 create 移除

This commit is contained in:
2026-06-10 15:26:37 +08:00
parent a4c3a245c3
commit 932ee45f94
2 changed files with 77 additions and 24 deletions

View File

@@ -15,11 +15,11 @@ afterEach(async () => {
});
describe("injectClaudeCode", () => {
it("生成 discuss、create、plan、build、archive 的 command 文件", async () => {
it("生成 discuss、plan、build、archive 的 command 文件", async () => {
await injectClaudeCode(TMP_DIR);
const commands = await readdir(join(TMP_DIR, ".claude", "commands"));
for (const stage of ["discuss", "create", "plan", "build", "archive"]) {
for (const stage of ["discuss", "plan", "build", "archive"]) {
expect(commands).toContain(`rune-${stage}.md`);
}
});
@@ -48,10 +48,10 @@ describe("injectClaudeCode", () => {
expect(content).toContain("```bash");
});
it("create/plan/build/archive command 包含变更名智能识别引导", async () => {
it("plan/build/archive command 包含变更名智能识别引导", async () => {
await injectClaudeCode(TMP_DIR);
for (const stage of ["create", "plan", "build", "archive"]) {
for (const stage of ["plan", "build", "archive"]) {
const content = await readFile(
join(TMP_DIR, ".claude", "commands", `rune-${stage}.md`),
"utf-8",
@@ -70,6 +70,36 @@ describe("injectClaudeCode", () => {
expect(content).not.toContain("智能识别");
});
it("不生成 rune-create command", async () => {
await injectClaudeCode(TMP_DIR);
const commands = await readdir(join(TMP_DIR, ".claude", "commands"));
expect(commands).not.toContain("rune-create.md");
});
it("plan command 包含 create 引导", async () => {
await injectClaudeCode(TMP_DIR);
const content = await readFile(join(TMP_DIR, ".claude", "commands", "rune-plan.md"), "utf-8");
expect(content).toContain("如果变更目录尚不存在");
expect(content).toContain("rune create <变更名>");
});
it("discuss command 包含 create 引导", async () => {
await injectClaudeCode(TMP_DIR);
const content = await readFile(
join(TMP_DIR, ".claude", "commands", "rune-discuss.md"),
"utf-8",
);
expect(content).toContain("讨论结束后");
expect(content).toContain("rune create <变更名>");
});
it("intro command 不包含 rune-create 作为独立命令", async () => {
await injectClaudeCode(TMP_DIR);
const content = await readFile(join(TMP_DIR, ".claude", "commands", "rune-intro.md"), "utf-8");
expect(content).not.toContain("/rune-create");
expect(content).toContain("rune create <变更名>");
});
it("重复注入时不覆盖已存在的文件", async () => {
await injectClaudeCode(TMP_DIR);
const originalContent = await readFile(