Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

1011 B
Raw Blame
import { screen } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { renderWithProviders } from "@/../tests/test-utils";
import { ChatShellProvider, useChatShell } from "./ChatShellContext";

function ActiveConversationId() {
  const { activeConversationId } = useChatShell();
  return <span>{activeConversationId}</span>;
}

describe("ChatShellProvider URL state", () => {
  beforeEach(() => {
    localStorage.clear();
  });

  afterEach(() => {
    localStorage.clear();
  });

  it("reads the active conversation ID from the nuqs adapter", () => {
    renderWithProviders(
      <ChatShellProvider
        accessToken="token"
        userId="test-user"
        userEmail="[email protected]"
        userRole="Admin"
        premiumUser={false}
      >
        <ActiveConversationId />
      </ChatShellProvider>,
      { searchParams: "?id=conversation-123" },
    );

    expect(screen.getByText("conversation-123")).toBeInTheDocument();
  });
});