diff --git a/quickwit/quickwit-ui/src/views/IndexView.test.jsx b/quickwit/quickwit-ui/src/views/IndexView.test.jsx
index 0894b2a3dcd..5a91a289e0e 100644
--- a/quickwit/quickwit-ui/src/views/IndexView.test.jsx
+++ b/quickwit/quickwit-ui/src/views/IndexView.test.jsx
@@ -17,12 +17,12 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
-import { render, unmountComponentAtNode } from "react-dom";
-import { waitFor } from "@testing-library/react";
-import { screen } from '@testing-library/dom';
+import { unmountComponentAtNode } from "react-dom";
+import { render, waitFor, screen } from "@testing-library/react";
import { act } from "react-dom/test-utils";
import { Client } from "../services/client";
import IndexView from "./IndexView";
+import { BrowserRouter } from "react-router-dom";
jest.mock('../services/client');
const mockedUsedNavigate = jest.fn();
@@ -33,20 +33,6 @@ jest.mock('react-router-dom', () => ({
})
}));
-let container = null;
-beforeEach(() => {
- // setup a DOM element as a render target
- container = document.createElement("div");
- document.body.appendChild(container);
-});
-
-afterEach(() => {
- // cleanup on exiting
- unmountComponentAtNode(container);
- container.remove();
- container = null;
-});
-
test('renders IndexView', async () => {
const index = {
metadata: {
@@ -59,7 +45,7 @@ test('renders IndexView', async () => {
Client.prototype.getIndex.mockImplementation(() => Promise.resolve(index));
await act(async () => {
- render(, container);
+ render( , {wrapper: BrowserRouter});
});
await waitFor(() => expect(screen.getByText(/my-new-fresh-index-uri/)).toBeInTheDocument());