This commit is contained in:
@@ -75,7 +75,7 @@ describe('web tools', () => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('blocks WebFetch on PDF responses and suggests ReadPdf', async () => {
|
||||
it('blocks WebFetch on PDF responses and suggests DownloadFile + Read', async () => {
|
||||
workspacePath = makeWorkspace();
|
||||
vi.stubGlobal('fetch', vi.fn().mockResolvedValue(new Response('%PDF-1.4', {
|
||||
status: 200,
|
||||
@@ -86,7 +86,8 @@ describe('web tools', () => {
|
||||
|
||||
expect(result).not.toBeNull();
|
||||
expect(result?.isError).toBe(true);
|
||||
expect(result?.output).toContain('ReadPdf');
|
||||
expect(result?.output).toContain('Read');
|
||||
expect(result?.output).not.toContain('ReadPdf');
|
||||
const history = fs.readFileSync(path.join(workspacePath, 'logs', 'webfetch-history.jsonl'), 'utf-8').trim().split('\n').map((line) => JSON.parse(line) as Record<string, unknown>);
|
||||
expect(history).toHaveLength(1);
|
||||
expect(history[0]?.url).toBe('https://example.com/manual.pdf');
|
||||
|
||||
Reference in New Issue
Block a user