test(feishu): add regression for audio download resource type=file (openclaw#16311) thanks @Yaxuan42

Verified:
- pnpm build
- pnpm check
- pnpm vitest run --config vitest.extensions.config.ts extensions/feishu/src/bot.test.ts extensions/feishu/src/media.test.ts

Co-authored-by: Yaxuan42 <184813557+Yaxuan42@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
YAXUAN
2026-02-28 12:49:05 +08:00
committed by GitHub
parent b28344eacc
commit 8beb048a84
4 changed files with 86 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
import type { ClawdbotConfig, PluginRuntime, RuntimeEnv } from "openclaw/plugin-sdk";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { FeishuMessageEvent } from "./bot.js";
import { buildFeishuAgentBody, handleFeishuMessage } from "./bot.js";
import { buildFeishuAgentBody, handleFeishuMessage, toMessageResourceType } from "./bot.js";
import { setFeishuRuntime } from "./runtime.js";
const {
@@ -993,3 +993,19 @@ describe("handleFeishuMessage command authorization", () => {
);
});
});
describe("toMessageResourceType", () => {
it("maps image to image", () => {
expect(toMessageResourceType("image")).toBe("image");
});
it("maps audio to file", () => {
expect(toMessageResourceType("audio")).toBe("file");
});
it("maps video/file/sticker to file", () => {
expect(toMessageResourceType("video")).toBe("file");
expect(toMessageResourceType("file")).toBe("file");
expect(toMessageResourceType("sticker")).toBe("file");
});
});