← Back to PRs

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

by Yaxuan42 open 2026-02-14 16:30 View on GitHub →
channel: feishu stale size: S
## 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