#16311: test(feishu): add regression for audio download resource type=file
channel: feishu
stale
size: S
Cluster:
Feishu Streaming Enhancements
## Summary
Adds a regression test ensuring Feishu audio message resource downloads use `type=file` (Feishu API only supports `type=image|file`).
## Context
The runtime logic already maps non-image message types to `type=file`, but we had no test coverage to prevent re-introducing `type=audio` (which causes HTTP 400 per Feishu docs).
## Changes
- Add `downloadMessageResourceFeishu` test suite in `extensions/feishu/src/media.test.ts`
- audio uses type=file
- image uses type=image
Fixes #8746
## Test plan
- [x] `npx vitest run extensions/feishu/src/media.test.ts`
- [x] `pnpm lint`
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds a test suite for `downloadMessageResourceFeishu` in the Feishu extension, with two test cases verifying that the function correctly forwards `type=file` for audio resources and `type=image` for image resources to the Feishu SDK.
- The mock setup and test structure follow existing patterns in the file and are well-organized
- The actual audio→file mapping that prevents #8746 regressions lives in `bot.ts` (`extractMediaFromMessage`), not in `downloadMessageResourceFeishu` — the test validates parameter forwarding but doesn't cover the mapping logic itself
- No runtime or type safety issues introduced
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge — it only adds test code with no production changes.
- Pure test addition with no production code changes. The tests are correct in what they verify (parameter forwarding), though the "audio uses type=file" test doesn't cover the actual mapping logic in bot.ts that prevents the #8746 regression. No risk to existing behavior.
- No files require special attention
<sub>Last reviewed commit: 05ca5a2</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#13669: feat(feishu): add audio message support
by AGI-XiaoBai-No1 · 2026-02-10
79.8%
#10675: feat(feishu): add audio message support and fix file upload
by YumoeZhung · 2026-02-06
79.7%
#15351: feat(feishu): Add native audio message support (voice bubble)
by lovejing0306 · 2026-02-13
78.3%
#21786: feat(feishu): extract embedded video/media from post (rich text) me...
by laopuhuluwa · 2026-02-20
74.5%
#8048: Media: add regression test for audio text blocks (#7970)
by Abhishek-B-R · 2026-02-03
73.1%
#18811: fix(media): require file extension for ambiguous MEDIA: path detection
by aldoeliacim · 2026-02-17
71.2%
#11160: Media: add missing audio MIME-to-extension mappings (aac, flac, opu...
by lailoo · 2026-02-07
70.8%
#11443: LINE: fix buffer guards in detectContentType + add tests
by MdRahmatUllah · 2026-02-07
70.7%
#22957: fix(feishu): download media from quoted messages in group chats (#2...
by echoVic · 2026-02-21
69.9%
#12755: feat(feishu): render post rich text as markdown
by WilsonLiu95 · 2026-02-09
69.4%