mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
test: trim redundant web media prefix coverage
This commit is contained in:
@@ -128,45 +128,14 @@ describe("web media loading", () => {
|
||||
});
|
||||
|
||||
it("strips MEDIA: prefix before reading local file", async () => {
|
||||
const buffer = await sharp({
|
||||
create: { width: 2, height: 2, channels: 3, background: "#0000ff" },
|
||||
})
|
||||
.png()
|
||||
.toBuffer();
|
||||
|
||||
const file = await writeTempFile(buffer, ".png");
|
||||
|
||||
const result = await loadWebMedia(`MEDIA:${file}`, 1024 * 1024);
|
||||
|
||||
expect(result.kind).toBe("image");
|
||||
expect(result.buffer.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it("strips MEDIA: prefix with whitespace after colon", async () => {
|
||||
const buffer = await sharp({
|
||||
create: { width: 2, height: 2, channels: 3, background: "#0000ff" },
|
||||
})
|
||||
.png()
|
||||
.toBuffer();
|
||||
|
||||
const file = await writeTempFile(buffer, ".png");
|
||||
|
||||
const result = await loadWebMedia(`MEDIA: ${file}`, 1024 * 1024);
|
||||
const result = await loadWebMedia(`MEDIA:${tinyPngFile}`, 1024 * 1024);
|
||||
|
||||
expect(result.kind).toBe("image");
|
||||
expect(result.buffer.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it("strips MEDIA: prefix with extra whitespace (LLM-friendly)", async () => {
|
||||
const buffer = await sharp({
|
||||
create: { width: 2, height: 2, channels: 3, background: "#0000ff" },
|
||||
})
|
||||
.png()
|
||||
.toBuffer();
|
||||
|
||||
const file = await writeTempFile(buffer, ".png");
|
||||
|
||||
const result = await loadWebMedia(` MEDIA : ${file}`, 1024 * 1024);
|
||||
const result = await loadWebMedia(` MEDIA : ${tinyPngFile}`, 1024 * 1024);
|
||||
|
||||
expect(result.kind).toBe("image");
|
||||
expect(result.buffer.length).toBeGreaterThan(0);
|
||||
|
||||
Reference in New Issue
Block a user