quivr/frontend/app/chat/[chatId]/__tests__/page.test.tsx
Mamadou DICKO b0514d6149
fix(i18n): update tests for french and spanish (#878)
* add libraries for traslation purposes

* Add button and service for language selection

* add spanish translation on login page

* add spanish translation on upload page

* Add spanish translations for explore page

* Add translations on user page

* Add translations for config page

* Add spanish translations on chat page

* add translations for brain page

* fix GUI and save on local storage

* fix (i18n) init and types

* fix (i18n): typos

* add translation on new brain modal

* add translations on metadata

* Add translations on home page

* fixes types

* fix(frontend-tests): use get by id instead of text

---------

Co-authored-by: Gustavo Maciel <gustavo_m13@outlook.com>
2023-08-07 14:13:41 +02:00

60 lines
1.7 KiB
TypeScript

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";
import SelectedChatPage from "../page";
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 } = render(
<SupabaseProviderMock>
<BrainConfigProviderMock>
<BrainProviderMock>
<SelectedChatPage />,
</BrainProviderMock>
</BrainConfigProviderMock>
</SupabaseProviderMock>
);
expect(getByTestId("chat-page")).toBeDefined();
expect(getByTestId("chat-messages")).toBeDefined();
expect(getByTestId("chat-input")).toBeDefined();
expect(getByTestId("page-heading-title")).toBeDefined();
expect(getByTestId("page-heading-subtitle")).toBeDefined();
});
});