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
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
import React from 'react';
import userEvent from '@testing-library/user-event';
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';
import { Constants } from 'librechat-data-provider';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import MarketplaceRoute from '../Marketplace';
const mockClearAllConversations = jest.fn();
const mockClearMessagesCache = jest.fn();
jest.mock('@librechat/chat/react', () => ({
...jest.requireActual('@librechat/chat/react'),
ChatProvider: ({ children }: { children: React.ReactNode }) => <>{children}</>,
}));
jest.mock('~/utils/messages', () => ({
clearMessagesCache: (...args: unknown[]) => mockClearMessagesCache(...args),
}));
jest.mock('~/store', () => ({
__esModule: true,
default: { useClearConvoState: () => mockClearAllConversations },
}));
const START_LABEL = 'start';
/** Stands in for the marketplace so the assertion is about what the shell supplies. */
jest.mock('~/components/Agents/Marketplace', () => () => {
/* eslint-disable-next-line @typescript-eslint/no-require-imports */
const { useMarketplaceHost: useHost } = require('~/components/Agents/MarketplaceContext');
const { resetNewConversation } = useHost();
return <button type="button" aria-label="start" onClick={resetNewConversation} />;
});
describe('MarketplaceRoute', () => {
beforeEach(() => jest.clearAllMocks());
it('resets the open conversations and the new-chat transcript for the marketplace', async () => {
const user = userEvent.setup();
const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });
render(
<QueryClientProvider client={queryClient}>
<MarketplaceRoute />
</QueryClientProvider>,
);
await user.click(screen.getByRole('button', { name: START_LABEL }));
/* `true` clears every parallel conversation a multi-conversation session left open,
not just the active one, so an agent started from a card is a new conversation
rather than another column beside them. */
expect(mockClearAllConversations).toHaveBeenCalledWith(true);
expect(mockClearMessagesCache).toHaveBeenCalledWith(expect.anything(), Constants.NEW_CONVO);
});
});