mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: Robert Brennan <accounts@rbren.io> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: amanape <83104063+amanape@users.noreply.github.com> Co-authored-by: Rohit Malhotra <rohitvinodmalhotra@gmail.com> Co-authored-by: Engel Nyst <enyst@users.noreply.github.com> Co-authored-by: tofarr <tofarr@gmail.com> Co-authored-by: Ray Myers <ray.myers@gmail.com> Co-authored-by: மனோஜ்குமார் பழனிச்சாமி <smartmanoj42857@gmail.com> Co-authored-by: Lenshood <lenshood.zxh@gmail.com> Co-authored-by: OpenHands <opendevin@all-hands.dev> Co-authored-by: mamoodi <mamoodiha@gmail.com> Co-authored-by: Graham Neubig <neubig@gmail.com>
33 lines
886 B
TypeScript
33 lines
886 B
TypeScript
import { afterAll, afterEach, beforeAll, vi } from "vitest";
|
|
import { cleanup } from "@testing-library/react";
|
|
import { server } from "#/mocks/node";
|
|
import "@testing-library/jest-dom/vitest";
|
|
|
|
HTMLCanvasElement.prototype.getContext = vi.fn();
|
|
HTMLElement.prototype.scrollTo = vi.fn();
|
|
|
|
// Mock the i18n provider
|
|
vi.mock("react-i18next", async (importOriginal) => ({
|
|
...(await importOriginal<typeof import("react-i18next")>()),
|
|
useTranslation: () => ({
|
|
t: (key: string) => key,
|
|
i18n: {
|
|
language: "en",
|
|
exists: () => false,
|
|
},
|
|
}),
|
|
}));
|
|
|
|
vi.mock("#/hooks/use-is-on-tos-page", () => ({
|
|
useIsOnTosPage: () => false,
|
|
}));
|
|
|
|
// Mock requests during tests
|
|
beforeAll(() => server.listen({ onUnhandledRequest: "bypass" }));
|
|
afterEach(() => {
|
|
server.resetHandlers();
|
|
// Cleanup the document body after each test
|
|
cleanup();
|
|
});
|
|
afterAll(() => server.close());
|