Files
oh-my-pi/packages/coding-agent/test/helpers/acp-schema.ts
T
can1357 fd06fe07ae refactor(coding-agent): migrated tool schema helpers to toolWireSchema
- Swapped legacy `zodToWireSchema` for `toolWireSchema` to normalize tool schemas.
- Updated `getSchemaPropertyKeys` in `tool-index.ts` to process schemas via `toolWireSchema`.
- Refactored tool token estimation in `context-usage.ts` to utilize the new schema helper.
- Fixed ArkType assertion checks in test helpers to correctly verify instances against `arkType.errors`.
- Aligned test suites and mock specifications with raw schema-based parameters instead of manually stringified JSON structures.
2026-06-18 01:57:23 +02:00

22 lines
653 B
TypeScript

import { expect } from "bun:test";
import { type as arkType, type Type } from "arktype";
function formatIssues(error: unknown): string {
if (error instanceof Error) {
return error.message;
}
return String(error);
}
export function expectAcpStructure(schema: Type, value: unknown): void {
const result = schema(value);
const isValid = !(result instanceof arkType.errors);
expect(isValid, isValid ? undefined : formatIssues(result)).toBe(true);
}
export function expectAcpStructureRejects(schema: Type, value: unknown): void {
const result = schema(value);
const isValid = !(result instanceof arkType.errors);
expect(isValid).toBe(false);
}