test: add fixture-based tests and snapshots for MCP tools - #12
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds fixture-based Vitest coverage for multiple PCM MCP tools by introducing a mock MCP server harness, shared save-fixture helpers, and snapshot-based assertions of tool outputs across several official-release .cdb databases.
Changes:
- Add a dedicated
tsconfig.test.jsonand adjust TS config to support a test-focused build/setup. - Add a mock
McpServerharness plus shared.cdbfixture helpers, and implement new tool tests using those fixtures. - Add/refresh Vitest snapshot files capturing structured outputs for several tools; refactor
pcm_get_table_schemato reuse an exported input schema.
Reviewed changes
Copilot reviewed 16 out of 22 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.test.json | Adds a test-specific TS config for compiling/typechecking test sources. |
| tsconfig.json | Removes rootDir to avoid constraining TS project root to ./src. |
| src/tools/get-table-schema.ts | Extracts/export tool input schema for reuse and updates the callback typing. |
| test/mocks/mock-mcp-server.ts | Adds a mock MCP server harness for registering tools and invoking callbacks in tests. |
| test/fixtures/save.fixture.ts | Adds a shared list of .cdb fixtures used across tool tests. |
| test/save-db.test.ts | Tightens mock typing/casts used in withSaveDb tests. |
| test/tools/get-save-schema.test.ts | Adds registration + fixture-based snapshot tests for pcm_get_save_schema. |
| test/tools/get-table-schema.test.ts | Adds registration + fixture-based snapshot tests for pcm_get_table_schema. |
| test/tools/get-team-roster.test.ts | Adds registration + fixture-based snapshot tests for pcm_get_team_roster. |
| test/tools/search-cyclist.test.ts | Adds registration + fixture-based snapshot tests for pcm_search_cyclist. |
| test/tools/search-team.test.ts | Adds registration + fixture-based snapshot tests for pcm_search_team. |
| test/tools/get-player-info.test.ts | Adds registration + fixture-based tests asserting graceful error behavior for pcm_get_player_info. |
| test/tools/snapshots/get-save-schema.test.ts.snap | Snapshot baselines for pcm_get_save_schema outputs per fixture. |
| test/tools/snapshots/get-table-schema.test.ts.snap | Snapshot baselines for pcm_get_table_schema outputs per fixture. |
| test/tools/snapshots/get-team-roster.test.ts.snap | Snapshot baselines for pcm_get_team_roster outputs per fixture. |
| test/tools/snapshots/search-cyclist.test.ts.snap | Snapshot baselines for pcm_search_cyclist outputs per fixture. |
| test/tools/snapshots/search-team.test.ts.snap | Snapshot baselines for pcm_search_team outputs per fixture. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Adds fixture-based test coverage for the MCP tools using real PCM save databases as test fixtures.
.cdbsave fixtures (2019, 2021, 2025) and a sharedsave.fixture.tshelpertest/mocks/mock-mcp-server.ts) for exercising toolsgetSaveSchema,getTableSchema,getTeamRoster,searchCyclist,searchTeam, andgetPlayerInfotsconfig.test.jsonfor the test build and update import paths for the mock server