The open-source agent harness - the runtime layer that turns an LLM into a working agent.
// This file was auto-generated by Fern from our API Definition.
import * as TrueForgeTypes from "../../../src/api/index";
import { TrueForge } from "../../../src/Client";
import { mockServerPool } from "../../mock-server/MockServerPool";
describe("SchedulesClient", () => {
test("execute_run (1)", async () => {
const server = mockServerPool.createServer();
const client = new TrueForge({ maxRetries: 0, token: "test", baseUrl: server.baseUrl });
const rawRequestBody = { schedule_run_id: "schedule_run_id" };
server
.mockEndpoint()
.post("/api/internal/schedules/runs/execute")
.jsonBody(rawRequestBody)
.respondWith()
.statusCode(200)
.build();
const response = await client.internal.schedules.executeRun({
scheduleRunId: "schedule_run_id",
});
expect(response).toEqual(undefined);
});
test("execute_run (2)", async () => {
const server = mockServerPool.createServer();
const client = new TrueForge({ maxRetries: 0, token: "test", baseUrl: server.baseUrl });
const rawRequestBody = { schedule_run_id: "x" };
const rawResponseBody = { error: { message: "message" } };
server
.mockEndpoint()
.post("/api/internal/schedules/runs/execute")
.jsonBody(rawRequestBody)
.respondWith()
.statusCode(401)
.jsonBody(rawResponseBody)
.build();
await expect(async () => {
return await client.internal.schedules.executeRun({
scheduleRunId: "x",
});
}).rejects.toThrow(TrueForgeTypes.UnauthorizedError);
});
test("execute_run (3)", async () => {
const server = mockServerPool.createServer();
const client = new TrueForge({ maxRetries: 0, token: "test", baseUrl: server.baseUrl });
const rawRequestBody = { schedule_run_id: "x" };
const rawResponseBody = { error: { message: "message" } };
server
.mockEndpoint()
.post("/api/internal/schedules/runs/execute")
.jsonBody(rawRequestBody)
.respondWith()
.statusCode(404)
.jsonBody(rawResponseBody)
.build();
await expect(async () => {
return await client.internal.schedules.executeRun({
scheduleRunId: "x",
});
}).rejects.toThrow(TrueForgeTypes.NotFoundError);
});
test("execute_run (4)", async () => {
const server = mockServerPool.createServer();
const client = new TrueForge({ maxRetries: 0, token: "test", baseUrl: server.baseUrl });
const rawRequestBody = { schedule_run_id: "x" };
const rawResponseBody = { error: { message: "message" } };
server
.mockEndpoint()
.post("/api/internal/schedules/runs/execute")
.jsonBody(rawRequestBody)
.respondWith()
.statusCode(422)
.jsonBody(rawResponseBody)
.build();
await expect(async () => {
return await client.internal.schedules.executeRun({
scheduleRunId: "x",
});
}).rejects.toThrow(TrueForgeTypes.UnprocessableEntityError);
});
});