Files
oh-my-pi/packages/coding-agent/test/helpers/acp-schema.ts
T
Ogrodev d8e38bcc62 test(acp): add comprehensive ACP and edit tool test suites
- AcpAgent integration tests: initialize→run→notify cycle, notification structure, message-ID continuity
- ACP built-in slash command unit tests across all command handlers via fake runtime
- ACP event mapper unit tests: text chunks, thinking, tool calls/results, errors → SessionNotification
- ACP initialize conformance: terminal auth capability negotiation, agentInfo/agentCapabilities contract
- stdout hygiene smoke test: first bytes on omp acp stdout must be a valid JSON-RPC frame
- AgentSession permission gate: allow-once, reject-once, allow-always, abort-during-pending, non-gated tools
- BashTool ACP terminal routing: bridge dispatch vs local PTY fallback
- EditTool diff content propagation: patch, replace, and multi-file aggregation paths
- ReadTool and WriteTool ACP filesystem permission tests
- Shared ACP schema test helper
2026-05-13 06:00:45 +02:00

17 lines
607 B
TypeScript

import { expect } from "bun:test";
import type * as z from "zod/v4";
function formatIssues(error: z.ZodError): string {
return error.issues.map(issue => `${issue.path.join(".") || "<root>"}: ${issue.message}`).join("\n");
}
export function expectAcpStructure(schema: z.ZodType, value: unknown): void {
const result = schema.safeParse(value);
expect(result.success, result.success ? undefined : formatIssues(result.error)).toBe(true);
}
export function expectAcpStructureRejects(schema: z.ZodType, value: unknown): void {
const result = schema.safeParse(value);
expect(result.success).toBe(false);
}