Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

821 B
Raw Blame
import { selectInitializedMCPServer } from '../useMCPServerManager';

describe('selectInitializedMCPServer', () => {
  it('preserves selections from concurrent initialization completions', () => {
    const valuesRef = { current: [] as string[] };
    const setValues = jest.fn();

    selectInitializedMCPServer(valuesRef, setValues, 'github');
    selectInitializedMCPServer(valuesRef, setValues, 'spotify');

    expect(valuesRef.current).toEqual(['github', 'spotify']);
    expect(setValues).toHaveBeenLastCalledWith(['github', 'spotify']);
  });

  it('does not write a selection that is already present', () => {
    const valuesRef = { current: ['github'] };
    const setValues = jest.fn();

    selectInitializedMCPServer(valuesRef, setValues, 'github');

    expect(setValues).not.toHaveBeenCalled();
  });
});