From 5f4ddc8fd7d84500457bb08b0981a84a2d1594b1 Mon Sep 17 00:00:00 2001
From: Hassan Abouelela <hassan@hassanamr.com>
Date: Sat, 18 Jun 2022 23:59:14 +0400
Subject: Bump React To 18.2.0

Bump react to v18, and handle all the breaking changes. This includes
bumping a lot of other dependencies to versions which support react 18,
and handling the breaking changes for those.

Refer to the following documents for migration guides:
React: https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html
Router: https://reactrouter.com/docs/en/v6/upgrading/v5

Signed-off-by: Hassan Abouelela <hassan@hassanamr.com>
---
 src/tests/pages/FormPage.test.tsx | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

(limited to 'src/tests/pages/FormPage.test.tsx')

diff --git a/src/tests/pages/FormPage.test.tsx b/src/tests/pages/FormPage.test.tsx
index 947c075..3a906f3 100644
--- a/src/tests/pages/FormPage.test.tsx
+++ b/src/tests/pages/FormPage.test.tsx
@@ -1,18 +1,13 @@
 import React from "react";
 import { render } from "@testing-library/react";
 
-import { createMemoryHistory } from "history";
-
-import { Route, BrowserRouter as Router } from "react-router-dom";
+import { MemoryRouter } from "react-router-dom";
 import FormPage from "../../pages/FormPage";
 
 import * as forms from "../../api/forms";
 
 test("renders specific form page with loading bar", () => {
-    const history = createMemoryHistory();
-    history.push("/form/route");
-
-    const { getByText } = render(<Router><Route history={history} ><FormPage /></Route></Router>);
+    const { getByText } = render(<FormPage/>, {wrapper: MemoryRouter});
     // If we rendered the headerbar we rendered the forms page.
     const headerBar = getByText(/Loading.../);
     expect(headerBar).toBeInTheDocument();
@@ -20,14 +15,11 @@ test("renders specific form page with loading bar", () => {
 
 /* TODO: Find why this test spits out promise errors that fail CI */
 test.skip("calls api method to load form", () => {
-    const history = createMemoryHistory();
-    history.push("/form/ban-appeals");
-
     const oldImpl = forms.getForm;
 
     Object.defineProperty(forms, "getForm", {value: jest.fn(oldImpl)});
 
-    render(<Router><Route history={history}><FormPage /></Route></Router>);
+    render(<FormPage/>, {wrapper: MemoryRouter});
 
     expect(forms.getForm).toBeCalled();
 });
-- 
cgit v1.2.3

