Skip to content

Commit 78a9dbf

Browse files
committed
fix agent run tests
1 parent daeed27 commit 78a9dbf

File tree

4 files changed

+25
-20
lines changed

4 files changed

+25
-20
lines changed

env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ PLANE_BASE_URL=your-plane-base-url
88
# Workspace configuration
99
TEST_WORKSPACE_SLUG=your-workspace-slug
1010

11+
# Agent configuration
12+
TEST_AGENT_SLUG=your-installed-agent-slug
13+
1114
# Project and user IDs
1215
TEST_PROJECT_ID=your-project-id
1316
TEST_USER_ID=your-user-id

src/api/AgentRuns/index.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,5 @@ export class AgentRuns extends BaseResource {
3434
async retrieve(workspaceSlug: string, runId: string): Promise<AgentRun> {
3535
return this.get<AgentRun>(`/workspaces/${workspaceSlug}/runs/${runId}/`);
3636
}
37-
38-
/**
39-
* Resume an agent run
40-
* @param workspaceSlug - The workspace slug
41-
* @param runId - The agent run ID
42-
* @returns The resumed agent run
43-
*/
44-
async resume(workspaceSlug: string, runId: string): Promise<AgentRun> {
45-
return this.post<AgentRun>(`/workspaces/${workspaceSlug}/runs/${runId}/`);
46-
}
4737
}
4838

tests/unit/agent-runs/activities.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { PlaneClient } from "../../../src/client/plane-client";
2-
import { AgentRun, AgentRunActivity } from "../../../src/models";
2+
import { AgentRun, AgentRunActivity, WorkItem, WorkItemComment } from "../../../src/models";
33
import { config } from "../constants";
44
import { createTestClient } from "../../helpers/test-utils";
55
import { describeIf as describe } from "../../helpers/conditional-tests";
@@ -10,18 +10,27 @@ describe(!!(config.workspaceSlug && config.agentSlug), "Agent Run Activities API
1010
let agentSlug: string;
1111
let projectId: string;
1212
let agentRun: AgentRun;
13+
let workItem: WorkItem;
14+
let comment: WorkItemComment;
1315
let activity: AgentRunActivity;
1416

1517
beforeAll(async () => {
1618
client = createTestClient();
1719
workspaceSlug = config.workspaceSlug;
1820
agentSlug = config.agentSlug;
1921
projectId = config.projectId;
20-
22+
workItem = await client.workItems.create(workspaceSlug, projectId, {
23+
name: "Test Work Item",
24+
description_html: "<p>Test Description</p>",
25+
});
26+
comment = await client.workItems.comments.create(workspaceSlug, projectId, workItem.id, {
27+
comment_html: "<p>Test Comment</p>",
28+
});
2129
// Create an agent run for testing activities
2230
agentRun = await client.agentRuns.create(workspaceSlug, {
2331
agent_slug: agentSlug,
2432
project: projectId,
33+
comment: comment.id,
2534
});
2635
});
2736

tests/unit/agent-runs/agent-runs.test.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { PlaneClient } from "../../../src/client/plane-client";
2-
import { AgentRun } from "../../../src/models";
2+
import { AgentRun, WorkItem, WorkItemComment } from "../../../src/models";
33
import { config } from "../constants";
44
import { createTestClient } from "../../helpers/test-utils";
55
import { describeIf as describe } from "../../helpers/conditional-tests";
@@ -10,18 +10,28 @@ describe(!!(config.workspaceSlug && config.agentSlug), "Agent Runs API Tests", (
1010
let agentSlug: string;
1111
let projectId: string;
1212
let agentRun: AgentRun;
13+
let workItem: WorkItem;
14+
let comment: WorkItemComment;
1315

1416
beforeAll(async () => {
1517
client = createTestClient();
1618
workspaceSlug = config.workspaceSlug;
1719
agentSlug = config.agentSlug;
1820
projectId = config.projectId;
21+
workItem = await client.workItems.create(workspaceSlug, projectId, {
22+
name: "Test Work Item",
23+
description_html: "<p>Test Description</p>",
24+
});
25+
comment = await client.workItems.comments.create(workspaceSlug, projectId, workItem.id, {
26+
comment_html: "<p>Test Comment</p>",
27+
});
1928
});
2029

2130
it("should create an agent run", async () => {
2231
agentRun = await client.agentRuns.create(workspaceSlug, {
2332
agent_slug: agentSlug,
2433
project: projectId,
34+
comment: comment.id,
2535
});
2636

2737
expect(agentRun).toBeDefined();
@@ -37,12 +47,5 @@ describe(!!(config.workspaceSlug && config.agentSlug), "Agent Runs API Tests", (
3747
expect(retrievedRun.id).toBe(agentRun.id);
3848
expect(retrievedRun.status).toBeDefined();
3949
});
40-
41-
it("should resume an agent run", async () => {
42-
const resumedRun = await client.agentRuns.resume(workspaceSlug, agentRun.id);
43-
44-
expect(resumedRun).toBeDefined();
45-
expect(resumedRun.id).toBe(agentRun.id);
46-
});
4750
});
4851

0 commit comments

Comments
 (0)