Test the 406 fallback in @fedify/express - #1000
Conversation
integrateFederation() calls onNotAcceptable to let Express try HTML routes before falling back to 406, but that fallback had no test. Add a test that asserts the middleware responds with 406 when onNotAcceptable is used and no Express route matches the request. Changelog: none Assisted-by: Claude Code:claude-opus-4-8
✅ Deploy Preview for fedify-json-schema canceled.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 4 reviews per rolling hour; 3 remain after this review. 📝 WalkthroughWalkthroughChangesExpress not-acceptable handling
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change adds coverage for the Express 406 fallback without changing production behavior. No actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
Resolves #858.
Summary
@fedify/express uses
onNotAcceptableto let Express try HTML routes before falling back to a 406, which is what keeps an actor and its HTML profile page shareable on one URL. The fallback branch—no route matched, so the middleware sends the 406 itself—had no test.This adds a test in packages/express/src/index.test.ts that drives
integrateFederation()with a mock federation callingonNotAcceptable(), and asserts the response status is 406.Tests
mise run test:deno packages/express/src/index.test.tsmise run check-each expressAI disclosure
Assisted-by: Claude Code:claude-opus 4.8
This change was written with assistance from Claude Code (
claude-opus-4-8), reviewed and verified by me.