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

997 B
Raw Blame
import { createClient } from '@redis/client';

describe('node-redis TLS URI handling', () => {
  it('infers TLS from a rediss:// url', () => {
    const client = createClient({ url: 'rediss://localhost:6380' });
    expect(client.options?.socket).toMatchObject({ tls: true });
  });

  it('leaves a redis:// url without TLS', () => {
    const client = createClient({ url: 'redis://localhost:6379' });
    expect(client.options?.socket).toMatchObject({ tls: false });
  });

  it('keeps custom CA material alongside the TLS flag', () => {
    const client = createClient({
      url: 'rediss://localhost:6380',
      socket: { tls: true, ca: 'test-ca' },
    });
    expect(client.options?.socket).toMatchObject({ tls: true, ca: 'test-ca' });
  });

  it('rejects an explicit TLS mismatch with a rediss:// url', () => {
    expect(() =>
      createClient({
        url: 'rediss://localhost:6380',
        socket: { tls: false },
      }),
    ).toThrow(/tls socket option.*mismatch/i);
  });
});