Skip to content

test(igniteui-mcp): add MCP cli and runtime unit tests#1572

Open
georgianastasov wants to merge 3 commits intofeat/igniteui-mcpfrom
ganastasov/igniteui-mcp-unit-tests
Open

test(igniteui-mcp): add MCP cli and runtime unit tests#1572
georgianastasov wants to merge 3 commits intofeat/igniteui-mcpfrom
ganastasov/igniteui-mcp-unit-tests

Conversation

@georgianastasov
Copy link
Copy Markdown

Summary

This PR adds focused unit tests for the new MCP integration for the CLI and the MCP runtime. The goal is to cover the most important behavior with small, practical tests that fit the repo’s existing Jasmine setup.

What was added

CLI tests for the ig mcp command:

  • resolving the installed MCP package
  • validating that the built entrypoint exists
  • forwarding --remote and --debug
  • spawning the MCP process with inherited stdio
  • propagating child exit codes and startup errors

Runtime tests for MCP logic:

  • API helper behavior such as section extraction and API search
  • tool handler success and error branches
  • remote docs provider success and failure paths
  • search_docs query sanitization
  • get_project_setup_guide behavior, including the Blazor-specific flow

Implementation

To make the runtime behavior easier to test cleanly, the search_docs sanitization logic and get_project_setup_guide assembly logic were extracted from src/index.ts into small helper functions. This does not change the intended behavior, but it makes the important MCP branches testable with stable unit tests.

Why this is useful

These tests give us confidence in the two places where the new MCP is working:

  • the CLI wrapper that launches the MCP server
  • the runtime logic that powers the MCP tools after startup

This keeps the coverage lightweight and meaningful, without introducing new test infrastructure or broader refactoring.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Jasmine unit coverage for the new Ignite UI MCP integration by testing both the CLI launcher (ig mcp) and the MCP runtime behavior, and slightly refactors runtime logic to make key branches testable.

Changes:

  • Added unit tests for the ig mcp CLI command (package resolution, entrypoint validation, argument forwarding, spawn/exit/error behavior).
  • Added unit tests covering MCP runtime helpers, tool handlers, remote/local docs providers, and setup-guide/query-sanitization behavior.
  • Extracted search_docs query sanitization and project setup guide assembly into dedicated helper functions used by the MCP server entrypoint.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
spec/unit/mcp-runtime-spec.ts New runtime-focused Jasmine tests for MCP helpers, handlers, and docs providers.
spec/unit/mcp-cli-spec.ts New Jasmine tests verifying ig mcp preflight checks and spawn/runtime behavior.
packages/igniteui-mcp/igniteui-doc-mcp/src/tools/doc-tools.ts New helper module for query sanitization and setup-guide assembly used by MCP tools.
packages/igniteui-mcp/igniteui-doc-mcp/src/index.ts Refactor to call extracted helper functions for search_docs and get_project_setup_guide.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants