litellm/ui/litellm-dashboard/src/contexts/ChatShellContext.integration.test.tsx
devin-ai-integration[bot] 8f6546df9f
refactor(ui): route dashboard URL state through nuqs parsers (#44537)
* docs(ui): add url-state agent skill

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* feat(ui): migrate dashboard URL state to nuqs

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(ui): cover chat URL id sync with the real chat shell provider

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Yujong Lee <yujong@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-04 22:49:51 -07:00

36 lines
1,011 B
TypeScript

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="test@example.com"
userRole="Admin"
premiumUser={false}
>
<ActiveConversationId />
</ChatShellProvider>,
{ searchParams: "?id=conversation-123" },
);
expect(screen.getByText("conversation-123")).toBeInTheDocument();
});
});