chenbhao commited on
Commit
c0f64e8
·
1 Parent(s): f62d3f6

test: add ImageShowTool remote image loading test

Browse files
src/tools/ImageShowTool/__tests__/ImageShowTool.test.tsx ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { describe, it, expect } from 'vitest';
2
+ import { ImageShowTool } from '../ImageShowTool';
3
+
4
+ // Remote image test to verify ImageShowTool loading and rendering logic
5
+ describe('ImageShowTool', () => {
6
+ it('loads and processes a remote image successfully', async () => {
7
+ const url = 'https://upload.wikimedia.org/wikipedia/en/7/7d/Lenna_%28test_image%29.png';
8
+ const result = await ImageShowTool.call({ url });
9
+ expect(result.data.success).toBe(true);
10
+ // Ensure the returned data includes image dimensions
11
+ expect(typeof result.data.naturalWidth).toBe('number');
12
+ expect(typeof result.data.naturalHeight).toBe('number');
13
+ // Base64 representation should be present
14
+ expect(typeof result.data.base64).toBe('string');
15
+ });
16
+ });