import { describe, expect, it } from "vitest"; import { ApiErrorSchema, HarnessEventSchema, MessageInputSchema, ModelConnectionInputSchema, } from "../src/index.js"; describe("shared schemas", () => { it("validates a harness event", () => expect( HarnessEventSchema.parse({ eventId: "e", sessionId: "s", timestamp: new Date().toISOString(), sequence: 1, type: "run.started", payload: {}, }).type, ).toBe("run.started")); it("requires message content", () => expect(() => MessageInputSchema.parse({ text: " ", attachmentIds: [] }), ).toThrow()); it("strictly validates model config", () => expect(() => ModelConnectionInputSchema.parse({ providerId: "p", api: "bad", modelId: "m", supportsImages: false, }), ).toThrow()); it("validates unified errors", () => expect( ApiErrorSchema.parse({ error: { code: "X", message: "x", requestId: "r", details: {} }, }).error.code, ).toBe("X")); });