test: cover the HTTP API and agent search#45
Merged
Conversation
Extract the Express app from dev.ts into app.ts with an injectable model loader so every route can be exercised over real HTTP without booting the file watcher or the bundler. Split the WebMCP search into a pure searchCatalog so the agent-facing search contract is unit-testable without a DOM; the visible-filter mirroring stays in searchModels. Add tests/server.test.ts (15 tests) covering every endpoint, 404 paths, and the suppressed x-powered-by header, plus tests/webmcp.test.ts (11 tests) covering query, provider, capability, and auth filtering, limits, and result shape. Both run in CI via the existing npm test step.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💭 Why
The data layer was well tested, but the HTTP API and the in-browser agent search had no coverage. A regression in either would have shipped silently.
✨ What changed
dev.tsintoapp.tswith an injectable model loader, so routes are testable without the watcher or bundler.searchCatalog(no DOM) for unit testing; UI mirroring stays insearchModels.x-powered-by) and 11 agent-search tests (query, provider, capability, auth, limits, shape).📝 Notes
Both files run in CI through the existing
npm teststep (vitest auto-discoverstests/**). No behavior change to the running app.