style: auto-fix ESLint issues (curly braces and formatting)
- Add curly braces to all if/else/for/while statements - Fix indentation and trailing spaces - Auto-fixed 372 linting errors using eslint --fix - Remaining issues are warnings only (non-null assertions, explicit any types)
This commit is contained in:
@@ -7,7 +7,7 @@ describe('image.analyze tool', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
mockClient = {
|
||||
chat: vi.fn()
|
||||
chat: vi.fn(),
|
||||
};
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('image.analyze tool', () => {
|
||||
mockClient.chat = vi.fn().mockResolvedValueOnce({
|
||||
content: 'This is a beautiful sunset over the ocean.',
|
||||
stopReason: 'end_turn',
|
||||
usage: { inputTokens: 100, outputTokens: 50 }
|
||||
usage: { inputTokens: 100, outputTokens: 50 },
|
||||
});
|
||||
|
||||
const tool = createImageAnalyzeTool(mockClient);
|
||||
@@ -46,15 +46,15 @@ describe('image.analyze tool', () => {
|
||||
source: expect.objectContaining({
|
||||
type: 'url',
|
||||
media_type: 'image/jpeg',
|
||||
url: 'https://example.com/image.jpg'
|
||||
})
|
||||
}
|
||||
])
|
||||
})
|
||||
url: 'https://example.com/image.jpg',
|
||||
}),
|
||||
},
|
||||
]),
|
||||
}),
|
||||
]),
|
||||
system: expect.stringContaining('vision assistant'),
|
||||
maxTokens: 1024
|
||||
})
|
||||
maxTokens: 1024,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -63,13 +63,13 @@ describe('image.analyze tool', () => {
|
||||
mockClient.chat = vi.fn().mockResolvedValueOnce({
|
||||
content: 'This is a sample image.',
|
||||
stopReason: 'end_turn',
|
||||
usage: { inputTokens: 100, outputTokens: 20 }
|
||||
usage: { inputTokens: 100, outputTokens: 20 },
|
||||
});
|
||||
|
||||
const tool = createImageAnalyzeTool(mockClient);
|
||||
const result = await tool.execute({
|
||||
data: base64Data,
|
||||
media_type: 'image/png'
|
||||
media_type: 'image/png',
|
||||
});
|
||||
|
||||
expect(result.success).toBe(true);
|
||||
@@ -87,15 +87,15 @@ describe('image.analyze tool', () => {
|
||||
source: expect.objectContaining({
|
||||
type: 'base64',
|
||||
media_type: 'image/png',
|
||||
data: base64Data
|
||||
})
|
||||
}
|
||||
])
|
||||
})
|
||||
data: base64Data,
|
||||
}),
|
||||
},
|
||||
]),
|
||||
}),
|
||||
]),
|
||||
system: expect.stringContaining('vision assistant'),
|
||||
maxTokens: 1024
|
||||
})
|
||||
maxTokens: 1024,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -103,13 +103,13 @@ describe('image.analyze tool', () => {
|
||||
mockClient.chat = vi.fn().mockResolvedValueOnce({
|
||||
content: 'The image shows a cat sitting on a mat.',
|
||||
stopReason: 'end_turn',
|
||||
usage: { inputTokens: 100, outputTokens: 30 }
|
||||
usage: { inputTokens: 100, outputTokens: 30 },
|
||||
});
|
||||
|
||||
const tool = createImageAnalyzeTool(mockClient);
|
||||
const result = await tool.execute({
|
||||
url: 'https://example.com/cat.jpg',
|
||||
prompt: 'What is in this image?'
|
||||
prompt: 'What is in this image?',
|
||||
});
|
||||
|
||||
expect(result.success).toBe(true);
|
||||
@@ -120,11 +120,11 @@ describe('image.analyze tool', () => {
|
||||
expect.objectContaining({
|
||||
content: expect.arrayContaining([
|
||||
{ type: 'text', text: 'What is in this image?' },
|
||||
expect.any(Object)
|
||||
])
|
||||
})
|
||||
])
|
||||
})
|
||||
expect.any(Object),
|
||||
]),
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -132,7 +132,7 @@ describe('image.analyze tool', () => {
|
||||
mockClient.chat = vi.fn().mockResolvedValueOnce({
|
||||
content: 'This is the default prompt response.',
|
||||
stopReason: 'end_turn',
|
||||
usage: { inputTokens: 100, outputTokens: 10 }
|
||||
usage: { inputTokens: 100, outputTokens: 10 },
|
||||
});
|
||||
|
||||
const tool = createImageAnalyzeTool(mockClient);
|
||||
@@ -144,11 +144,11 @@ describe('image.analyze tool', () => {
|
||||
expect.objectContaining({
|
||||
content: expect.arrayContaining([
|
||||
{ type: 'text', text: 'Describe this image in detail.' },
|
||||
expect.any(Object)
|
||||
])
|
||||
})
|
||||
])
|
||||
})
|
||||
expect.any(Object),
|
||||
]),
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -165,7 +165,7 @@ describe('image.analyze tool', () => {
|
||||
const tool = createImageAnalyzeTool(mockClient);
|
||||
const result = await tool.execute({
|
||||
url: 'https://example.com/image.jpg',
|
||||
data: 'base64data'
|
||||
data: 'base64data',
|
||||
});
|
||||
|
||||
expect(result.success).toBe(false);
|
||||
@@ -177,7 +177,7 @@ describe('image.analyze tool', () => {
|
||||
const tool = createImageAnalyzeTool(mockClient);
|
||||
const result = await tool.execute({
|
||||
data: 'base64data',
|
||||
prompt: 'Test'
|
||||
prompt: 'Test',
|
||||
});
|
||||
|
||||
expect(result.success).toBe(false);
|
||||
@@ -189,7 +189,7 @@ describe('image.analyze tool', () => {
|
||||
const tool = createImageAnalyzeTool(mockClient);
|
||||
const result = await tool.execute({
|
||||
data: 'base64data',
|
||||
media_type: 'image/tiff'
|
||||
media_type: 'image/tiff',
|
||||
});
|
||||
|
||||
expect(result.success).toBe(false);
|
||||
@@ -204,13 +204,13 @@ describe('image.analyze tool', () => {
|
||||
mockClient.chat = vi.fn().mockResolvedValueOnce({
|
||||
content: 'Success',
|
||||
stopReason: 'end_turn',
|
||||
usage: { inputTokens: 10, outputTokens: 10 }
|
||||
usage: { inputTokens: 10, outputTokens: 10 },
|
||||
});
|
||||
|
||||
const tool = createImageAnalyzeTool(mockClient);
|
||||
const result = await tool.execute({
|
||||
data: 'base64data',
|
||||
media_type: mediaType
|
||||
media_type: mediaType,
|
||||
});
|
||||
|
||||
expect(result.success).toBe(true);
|
||||
@@ -245,12 +245,12 @@ describe('image.analyze tool', () => {
|
||||
const mockRequest = {
|
||||
messages: [] as any,
|
||||
system: '',
|
||||
maxTokens: 1024
|
||||
maxTokens: 1024,
|
||||
};
|
||||
const mockResponse = {
|
||||
content: 'Analysis complete.',
|
||||
stopReason: 'end_turn',
|
||||
usage: { inputTokens: 100, outputTokens: 10 }
|
||||
usage: { inputTokens: 100, outputTokens: 10 },
|
||||
};
|
||||
|
||||
mockClient.chat = vi.fn().mockResolvedValue(mockResponse).mockImplementationOnce(async (r) => {
|
||||
@@ -260,7 +260,7 @@ describe('image.analyze tool', () => {
|
||||
const tool = createImageAnalyzeTool(mockClient);
|
||||
await tool.execute({
|
||||
url: 'https://example.com/image.jpg',
|
||||
prompt: 'Analyze the colors.'
|
||||
prompt: 'Analyze the colors.',
|
||||
});
|
||||
|
||||
const callArgs = (mockClient.chat as any).mock.calls[0][0];
|
||||
@@ -272,12 +272,12 @@ describe('image.analyze tool', () => {
|
||||
const mockRequest = {
|
||||
messages: [] as any,
|
||||
system: '',
|
||||
maxTokens: 1024
|
||||
maxTokens: 1024,
|
||||
};
|
||||
const mockResponse = {
|
||||
content: 'Short response',
|
||||
stopReason: 'end_turn',
|
||||
usage: { inputTokens: 10, outputTokens: 10 }
|
||||
usage: { inputTokens: 10, outputTokens: 10 },
|
||||
};
|
||||
|
||||
mockClient.chat = vi.fn().mockResolvedValueOnce(mockResponse);
|
||||
@@ -294,7 +294,7 @@ describe('image.analyze tool', () => {
|
||||
mockClient.chat.mockResolvedValueOnce({
|
||||
content: expectedContent,
|
||||
stopReason: 'end_turn',
|
||||
usage: { inputTokens: 100, outputTokens: 100 }
|
||||
usage: { inputTokens: 100, outputTokens: 100 },
|
||||
});
|
||||
|
||||
const tool = createImageAnalyzeTool(mockClient);
|
||||
|
||||
Reference in New Issue
Block a user