mirror of
https://github.com/BerriAI/litellm.git
synced 2026-12-04 01:48:57 +00:00
* 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>
36 lines
1,011 B
TypeScript
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();
|
|
});
|
|
});
|