Refactor read-file and support images. (#480)

This commit is contained in:
Jacob Richman 2025-05-29 22:30:18 +00:00 committed by GitHub
parent f21abdd1f0
commit dab7517622
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 1475 additions and 260 deletions

View file

@ -115,6 +115,33 @@ describe('ReadManyFilesTool', () => {
};
expect(tool.validateParams(params)).toBeNull();
});
it('should return error if paths array contains an empty string', () => {
const params = { paths: ['file1.txt', ''] };
expect(tool.validateParams(params)).toBe(
'Each item in "paths" must be a non-empty string/glob pattern.',
);
});
it('should return error if include array contains non-string elements', () => {
const params = {
paths: ['file1.txt'],
include: ['*.ts', 123] as string[],
};
expect(tool.validateParams(params)).toBe(
'If provided, "include" must be an array of strings/glob patterns.',
);
});
it('should return error if exclude array contains non-string elements', () => {
const params = {
paths: ['file1.txt'],
exclude: ['*.log', {}] as string[],
};
expect(tool.validateParams(params)).toBe(
'If provided, "exclude" must be an array of strings/glob patterns.',
);
});
});
describe('execute', () => {