豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 3a24d71

Browse files
authored
test: save WebP responses with the right extension (#1901)
## Summary - fix the WebP MIME type match in daemon response handling - save responses with a suffix instead of falling back to - add a regression test for WebP image handling ## Testing - npm run build - node --test --test-name-pattern="parsing" build/tests/daemon/client.test.js Fixes #1898
1 parent e3a5f6b commit 3a24d71

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/daemon/client.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,20 @@ describe('daemon client', () => {
107107
const response = await handleResponse(unsupportedContentResponse, 'md');
108108
assert.ok(response.includes('.png'));
109109
});
110+
111+
it('uses the webp extension for WebP images', async () => {
112+
const webpContentResponse = {
113+
content: [
114+
{
115+
type: 'image' as const,
116+
data: 'base64data',
117+
mimeType: 'image/webp',
118+
},
119+
],
120+
structuredContent: {},
121+
};
122+
const response = await handleResponse(webpContentResponse, 'md');
123+
assert.ok(response.includes('.webp'));
124+
});
110125
});
111126
});

0 commit comments

Comments
 (0)