2023-07-05 10:30:22 +03:00
|
|
|
import { render } from "@testing-library/react";
|
|
|
|
import { describe, expect, it, vi } from "vitest";
|
|
|
|
|
|
|
|
import {
|
|
|
|
BrainConfigContextMock,
|
|
|
|
BrainConfigProviderMock,
|
|
|
|
} from "@/lib/context/BrainConfigProvider/mocks/BrainConfigProviderMock";
|
|
|
|
import {
|
|
|
|
BrainContextMock,
|
|
|
|
BrainProviderMock,
|
|
|
|
} from "@/lib/context/BrainProvider/mocks/BrainProviderMock";
|
|
|
|
import {
|
|
|
|
ChatContextMock,
|
|
|
|
ChatProviderMock,
|
|
|
|
} from "@/lib/context/ChatProvider/mocks/ChatProviderMock";
|
|
|
|
import {
|
|
|
|
SupabaseContextMock,
|
|
|
|
SupabaseProviderMock,
|
|
|
|
} from "@/lib/context/SupabaseProvider/mocks/SupabaseProviderMock";
|
|
|
|
|
2023-07-05 19:33:18 +03:00
|
|
|
import SelectedChatPage from "../page";
|
2023-07-05 10:30:22 +03:00
|
|
|
|
|
|
|
vi.mock("@/lib/context/ChatProvider/ChatProvider", () => ({
|
|
|
|
ChatContext: ChatContextMock,
|
|
|
|
ChatProvider: ChatProviderMock,
|
|
|
|
}));
|
|
|
|
|
|
|
|
vi.mock("@/lib/context/SupabaseProvider/supabase-provider", () => ({
|
|
|
|
SupabaseContext: SupabaseContextMock,
|
|
|
|
}));
|
|
|
|
|
|
|
|
vi.mock("@/lib/context/BrainProvider/brain-provider", () => ({
|
|
|
|
BrainContext: BrainContextMock,
|
|
|
|
}));
|
|
|
|
|
|
|
|
vi.mock("@/lib/context/BrainConfigProvider/brain-config-provider", () => ({
|
|
|
|
BrainConfigContext: BrainConfigContextMock,
|
|
|
|
}));
|
|
|
|
|
|
|
|
describe("Chat page", () => {
|
|
|
|
it("should render chat page correctly", () => {
|
|
|
|
const { getByTestId, getByText } = render(
|
|
|
|
<SupabaseProviderMock>
|
|
|
|
<BrainConfigProviderMock>
|
|
|
|
<BrainProviderMock>
|
2023-07-05 19:33:18 +03:00
|
|
|
<SelectedChatPage />,
|
2023-07-05 10:30:22 +03:00
|
|
|
</BrainProviderMock>
|
|
|
|
</BrainConfigProviderMock>
|
|
|
|
</SupabaseProviderMock>
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(getByTestId("chat-page")).toBeDefined();
|
|
|
|
expect(getByTestId("chat-messages")).toBeDefined();
|
|
|
|
expect(getByTestId("chat-input")).toBeDefined();
|
|
|
|
|
2023-07-18 19:28:44 +03:00
|
|
|
expect(getByText("Chat with")).toBeDefined();
|
2023-07-05 10:30:22 +03:00
|
|
|
expect(
|
|
|
|
getByText("Talk to a language model about your uploaded data")
|
|
|
|
).toBeDefined();
|
|
|
|
});
|
|
|
|
});
|