Skip to content

Commit bef566a

Browse files
committed
Extend test for listing skills
1 parent 9f9673b commit bef566a

2 files changed

Lines changed: 26 additions & 8 deletions

File tree

src/__tests__/CodexACPAgent/e2e/acp-e2e.test.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import path from "node:path";
12
import {afterEach, expect, it} from "vitest";
23
import {AgentMode} from "../../../AgentMode";
34
import {
@@ -90,17 +91,33 @@ describeE2E("E2E tests", () => {
9091
});
9192
});
9293

93-
it("lists a user skill from the wrapped CODEX_HOME", async () => {
94+
it("lists skills", async () => {
9495
fixture = await createAuthenticatedFixture();
9596
fixture.writeSkill({
96-
name: "integration-skill",
97-
description: "Integration skill",
97+
name: "codex-home-skill",
98+
description: "Codex home skill",
9899
body: "This skill exists only for integration testing.",
99100
});
100-
const session = await fixture.createSession();
101+
const additionalSkillsRoot = path.join(fixture.workspaceDir, "custom-skills");
102+
fixture.writeSkill({
103+
name: "session-root-skill",
104+
description: "Session root skill",
105+
body: "This skill exists only in an additional root passed at session creation.",
106+
}, additionalSkillsRoot);
107+
108+
const session = await fixture.connection.newSession({
109+
cwd: fixture.workspaceDir,
110+
mcpServers: [],
111+
_meta: {
112+
additionalRoots: [additionalSkillsRoot],
113+
},
114+
});
115+
116+
// Expecting skills from CODEX_HOME, workspace, and additional root
101117
await fixture.expectPromptText(session.sessionId, "/skills", (text) => {
102118
expect(text).toContain("Available skills:");
103-
expect(text).toContain("- integration-skill: Integration skill");
119+
expect(text).toContain("- codex-home-skill: Codex home skill");
120+
expect(text).toContain("- session-root-skill: Session root skill");
104121
});
105122
});
106123
});

src/__tests__/CodexACPAgent/e2e/spawned-agent-fixture.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export interface SpawnedAgentFixture {
2222
readonly workspaceDir: string;
2323
createSession(mcpServers?: acp.McpServer[]): Promise<acp.NewSessionResponse>;
2424
restart(): Promise<SpawnedAgentFixture>;
25-
writeSkill(skill: TestSkill): void;
25+
writeSkill(skill: TestSkill, rootDir?: string): void;
2626
setPermissionResponder(responder: PermissionResponder): void;
2727
expectPromptText(
2828
sessionId: string,
@@ -170,8 +170,9 @@ class SpawnedAgentFixtureImpl implements SpawnedAgentFixture {
170170
return await createSpawnedAgentFixture(this.initializeConnection, this.extraEnv, this.paths);
171171
}
172172

173-
writeSkill(skill: TestSkill): void {
174-
const skillDirectory = path.join(this.paths.codexHome, "skills", skill.name);
173+
writeSkill(skill: TestSkill, rootDir?: string): void {
174+
const skillsRoot = rootDir ?? path.join(this.paths.codexHome, "skills");
175+
const skillDirectory = path.join(skillsRoot, skill.name);
175176
fs.mkdirSync(skillDirectory, {recursive: true});
176177
fs.writeFileSync(
177178
path.join(skillDirectory, "SKILL.md"),

0 commit comments

Comments
 (0)