fix: resolve M-01..M-02, M-05..M-08, L-01..L-03, L-05 from pre-release review
M-01: Compose OperationDefinitionSchema from OperationSpecSchema via Type.Intersect M-02: Extract from_openapi to subpath export, remove from main entry M-05: Fix mapError fragile includes() matching — use startsWith(code+':') or exact M-06: Replace any casts with MCPClientLike/MCPToolResult interfaces in from_mcp M-07: Add injectable fetch to HTTPServiceConfig for from_openapi M-08: Add OpenAPIServiceRegistry with lifecycle methods (add, remove, registerAll) L-01: Validate subscription handler type at registration and runtime L-02: Strengthen isResponseEnvelope with source-specific field validation L-03: Add logger.warn on FromSchema fallback to Type.Unknown L-04: Noted as intentional (SSE GET body handling) L-05: Add registerAll to MCPClientLoader and OpenAPIServiceRegistry
This commit is contained in:
@@ -240,6 +240,46 @@ describe("isResponseEnvelope", () => {
|
||||
it("returns false for object with numeric meta", () => {
|
||||
expect(isResponseEnvelope({ data: "hello", meta: 42 })).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false for local envelope missing operationId", () => {
|
||||
expect(isResponseEnvelope({ data: "hello", meta: { source: "local", timestamp: Date.now() } })).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false for local envelope with non-string operationId", () => {
|
||||
expect(isResponseEnvelope({ data: "hello", meta: { source: "local", operationId: 123, timestamp: Date.now() } })).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false for local envelope missing timestamp", () => {
|
||||
expect(isResponseEnvelope({ data: "hello", meta: { source: "local", operationId: "op.test" } })).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false for local envelope with non-number timestamp", () => {
|
||||
expect(isResponseEnvelope({ data: "hello", meta: { source: "local", operationId: "op.test", timestamp: "now" } })).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false for http envelope missing statusCode", () => {
|
||||
expect(isResponseEnvelope({ data: "hello", meta: { source: "http", headers: {}, contentType: "text/plain" } })).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false for http envelope with non-number statusCode", () => {
|
||||
expect(isResponseEnvelope({ data: "hello", meta: { source: "http", statusCode: "200", headers: {}, contentType: "text/plain" } })).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false for mcp envelope missing isError", () => {
|
||||
expect(isResponseEnvelope({ data: "hello", meta: { source: "mcp", content: [] } })).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false for mcp envelope with non-boolean isError", () => {
|
||||
expect(isResponseEnvelope({ data: "hello", meta: { source: "mcp", isError: "true", content: [] } })).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false for mcp envelope missing content", () => {
|
||||
expect(isResponseEnvelope({ data: "hello", meta: { source: "mcp", isError: false } })).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false for mcp envelope with non-array content", () => {
|
||||
expect(isResponseEnvelope({ data: "hello", meta: { source: "mcp", isError: true, content: "error" } })).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("unwrap", () => {
|
||||
|
||||
Reference in New Issue
Block a user