Skip to content

[MCPClient] Update test to use fake timers #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2025

Conversation

Jesperholmbergmsft
Copy link
Contributor

I found that a couple of the MCP client tests can be flaky, as they're dependent on system clock timing. To help stabilize them, this PR updates the affected tests to use fake timers instead of real ones.

@@ -4,29 +4,42 @@ import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
import type { Schema } from '@microsoft/teams.ai';

import { McpClientPlugin } from './mcp-client-plugin';
import { CreateTransport, McpClientPluginParams, McpClientToolDetails } from './mcp-client-types';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

npm run lint:fix made some white space changes too. The relevant changes are just to jest.useFakeTimers() in the beforeEach() and then jest.advanceTimersByTime() in the two tests.

@heyitsaamir heyitsaamir merged commit cdad13d into microsoft:main May 12, 2025
5 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