Skip to content

test: add fixture-based tests and snapshots for MCP tools - #12

Merged
mpicciolli merged 6 commits into
mainfrom
feat/add-fixture-tests
Jul 1, 2026
Merged

test: add fixture-based tests and snapshots for MCP tools#12
mpicciolli merged 6 commits into
mainfrom
feat/add-fixture-tests

Conversation

@mpicciolli

@mpicciolli mpicciolli commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds fixture-based test coverage for the MCP tools using real PCM save databases as test fixtures.

  • Add .cdb save fixtures (2019, 2021, 2025) and a shared save.fixture.ts helper
  • Add a mock MCP server harness (test/mocks/mock-mcp-server.ts) for exercising tools
  • Add tests and snapshots for getSaveSchema, getTableSchema, getTeamRoster, searchCyclist, searchTeam, and getPlayerInfo
  • Add tsconfig.test.json for the test build and update import paths for the mock server

Copilot AI review requested due to automatic review settings July 1, 2026 22:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.json and adjust TS config to support a test-focused build/setup.
  • Add a mock McpServer harness plus shared .cdb fixture helpers, and implement new tool tests using those fixtures.
  • Add/refresh Vitest snapshot files capturing structured outputs for several tools; refactor pcm_get_table_schema to 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.

Comment thread src/tools/get-table-schema.ts Outdated
Comment thread test/tools/get-team-roster.test.ts
Comment thread test/mocks/mock-mcp-server.ts
Comment thread test/mocks/mock-mcp-server.ts
Comment thread test/mocks/mock-mcp-server.ts
Comment thread test/mocks/mock-mcp-server.ts
@mpicciolli
mpicciolli merged commit f4d8f74 into main Jul 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants