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

1.2 KB
Raw Blame
const mockLock = { acquire: jest.fn(), extend: jest.fn(), release: jest.fn() };
const mockSyncPromptCatalog = jest.fn();
const mockCreateLangfusePromptSyncRunner = jest.fn(() => mockSyncPromptCatalog);
const mockLogger = { warn: jest.fn(), error: jest.fn() };
const mockPromptService = { importSourceGroup: jest.fn() };

jest.mock('@librechat/api', () => ({
  createLangfusePromptSyncRunner: mockCreateLangfusePromptSyncRunner,
}));

jest.mock('@librechat/data-schemas', () => ({
  logger: mockLogger,
}));

jest.mock('~/cache', () => ({
  distributedLock: mockLock,
}));

jest.mock('~/server/services/Prompts', () => ({
  promptService: mockPromptService,
}));

describe('LangfusePromptSync', () => {
  it('composes the sync runner once with the shared lock and the shared prompt service', () => {
    const { syncLangfusePromptCatalog } = require('./LangfusePromptSync');

    expect(mockCreateLangfusePromptSyncRunner).toHaveBeenCalledTimes(1);
    expect(mockCreateLangfusePromptSyncRunner).toHaveBeenCalledWith({
      lock: mockLock,
      promptService: mockPromptService,
      logger: mockLogger,
    });
    expect(syncLangfusePromptCatalog).toBe(mockSyncPromptCatalog);
  });
});