quivr/frontend/app/(home)/__tests__/Home.test.tsx
Mamadou DICKO 2b4c3ecbbc
feat: update header and improve ux (#1164)
* feat: add Knowledge tab

* feat: use tanstack query for knowledges fetching

* feat: update header

* feat: remove upload page

* feat: make chat page the default redirection page

* feat(homePage): redirect user to chat page when already authenticated
2023-09-13 16:43:25 +02:00

37 lines
858 B
TypeScript

import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import { getProcessEnvManager } from "@/lib/helpers/getProcessEnvManager";
import HomePage from "../page";
const mockUseSupabase = vi.fn(() => ({
session: {
user: {},
},
}));
vi.mock("@/lib/context/SupabaseProvider", () => ({
useSupabase: () => mockUseSupabase(),
}));
vi.mock("next/navigation", () => ({
redirect: (url: string) => url,
}));
describe("HomePage", () => {
it("should render HomePage component properly", () => {
const { overwriteEnvValuesWith, resetEnvValues } = getProcessEnvManager();
overwriteEnvValuesWith({
NEXT_PUBLIC_ENV: "not-local",
});
render(<HomePage />);
const homePage = screen.getByTestId("home-page");
expect(homePage).toBeDefined();
resetEnvValues();
});
});