mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-15 01:26:10 +00:00
feat(auth,ui): support github sign-in in the UI (#2545)
# What does this PR do? Uses NextAuth to add github sign in support. ## Test Plan Start server with auth configured as in https://github.com/meta-llama/llama-stack/pull/2509 https://github.com/user-attachments/assets/61ff7442-f601-4b39-8686-5d0afb3b45ac
This commit is contained in:
parent
c8bac888af
commit
daf660c4ea
23 changed files with 577 additions and 81 deletions
|
@ -12,21 +12,31 @@ jest.mock("next/navigation", () => ({
|
|||
}),
|
||||
}));
|
||||
|
||||
// Mock next-auth
|
||||
jest.mock("next-auth/react", () => ({
|
||||
useSession: () => ({
|
||||
status: "authenticated",
|
||||
data: { accessToken: "mock-token" },
|
||||
}),
|
||||
}));
|
||||
|
||||
// Mock helper functions
|
||||
jest.mock("@/lib/truncate-text");
|
||||
|
||||
// Mock the client
|
||||
jest.mock("@/lib/client", () => ({
|
||||
client: {
|
||||
responses: {
|
||||
list: jest.fn(),
|
||||
},
|
||||
// Mock the auth client hook
|
||||
const mockClient = {
|
||||
responses: {
|
||||
list: jest.fn(),
|
||||
},
|
||||
};
|
||||
|
||||
jest.mock("@/hooks/use-auth-client", () => ({
|
||||
useAuthClient: () => mockClient,
|
||||
}));
|
||||
|
||||
// Mock the usePagination hook
|
||||
const mockLoadMore = jest.fn();
|
||||
jest.mock("@/hooks/usePagination", () => ({
|
||||
jest.mock("@/hooks/use-pagination", () => ({
|
||||
usePagination: jest.fn(() => ({
|
||||
data: [],
|
||||
status: "idle",
|
||||
|
@ -40,7 +50,7 @@ jest.mock("@/hooks/usePagination", () => ({
|
|||
import { truncateText as originalTruncateText } from "@/lib/truncate-text";
|
||||
|
||||
// Import the mocked hook
|
||||
import { usePagination } from "@/hooks/usePagination";
|
||||
import { usePagination } from "@/hooks/use-pagination";
|
||||
const mockedUsePagination = usePagination as jest.MockedFunction<
|
||||
typeof usePagination
|
||||
>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue