diff --git a/frontend/src/components/Panel/Panel.test.tsx b/frontend/src/components/Panel/Panel.test.tsx
index 1232e82..93ea6be 100644
--- a/frontend/src/components/Panel/Panel.test.tsx
+++ b/frontend/src/components/Panel/Panel.test.tsx
@@ -1,5 +1,6 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { fireEvent, render } from "@testing-library/react";
+import React from "react";
import { getArticle } from "../../lib/api";
import { Language } from "../../lib/types";
import useNavState from "../../store/navStore";
@@ -22,22 +23,7 @@ const queryClient = new QueryClient({
},
},
});
-const renderWithClient = (ui: React.ReactElement) => {
- const { rerender, ...result } = render(
- {ui}
- );
- return {
- ...result,
- rerender: (rerenderUi: React.ReactElement) =>
- rerender(
-
- {rerenderUi}
-
- ),
- };
-};
-
-const wrapper = ({ children }) => (
+const wrapper = ({ children }: { children: React.ReactNode }) => (
{children}
);
@@ -70,7 +56,7 @@ describe("Panel Component", () => {
test("renders error state", async () => {
(getArticle as jest.Mock).mockRejectedValue(new Error("Failed to fetch"));
- const { findByText } = renderWithClient();
+ const { findByText } = render(, { wrapper });
expect(
await findByText("An error has occurred: Failed to fetch")
).toBeInTheDocument();
@@ -80,7 +66,7 @@ describe("Panel Component", () => {
const mockData = `
Test Content
`;
jest.mocked(getArticle).mockResolvedValue(mockData);
- const result = renderWithClient();
+ const result = render(, { wrapper });
expect(await result.findByText("Test Content")).toBeInTheDocument();
});
@@ -91,7 +77,7 @@ describe("Panel Component", () => {
`;
(getArticle as jest.Mock).mockResolvedValue(mockData);
- const result = renderWithClient();
+ const result = render(, { wrapper });
const paragraph1 = await result.findByText("Paragraph 1");
const paragraph2 = await result.findByText("Paragraph 2");
@@ -113,7 +99,7 @@ describe("Panel Component", () => {
.mockResolvedValue(
"Test Content
"
);
- const result = renderWithClient();
+ const result = render(, { wrapper });
const languageSwitcher = await result.findByRole("combobox");
expect(languageSwitcher).toBeInTheDocument();