tools.output_error.spec.ts•926 B
import { describe, it, expect } from 'vitest';
import { createTools } from '../src/tools/index.js';
import { AppError } from '../src/lib/errors.js';
class BadGL {
listProjects = async () => [{ nope: true } as any];
listMergeRequests = async () => [{ nope: true } as any];
listIssues = async () => [{ nope: true } as any];
}
class BadJira {
searchIssues = async () => ({ issues: 'not-array' } as any);
getIssue = async () => ({ notKey: true } as any);
}
describe('tools output shape errors', () => {
const tools = createTools({ cfg: {}, gitlab: new BadGL() as any, jira: new BadJira() as any });
it('wraps Zod error for gitlab_list_projects', async () => {
await expect(tools.gitlab_list_projects()).rejects.toBeInstanceOf(AppError);
});
it('wraps Zod error for jira_search_issues', async () => {
await expect(tools.jira_search_issues('project=TEST')).rejects.toBeInstanceOf(AppError);
});
});