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/CallbackPage.test.tsx | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

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

diff --git a/src/tests/pages/CallbackPage.test.tsx b/src/tests/pages/CallbackPage.test.tsx
index 70f2fed..37fb932 100644
--- a/src/tests/pages/CallbackPage.test.tsx
+++ b/src/tests/pages/CallbackPage.test.tsx
@@ -1,9 +1,9 @@
 import React from "react";
-import { render } from "@testing-library/react";
+import { render, waitFor } from "@testing-library/react";
 
 import CallbackPage from "../../pages/CallbackPage";
 
-test("callback page sends provided code", () => {
+test("callback page sends provided code", async () => {
     global.opener = {
         postMessage: jest.fn()
     };
@@ -14,9 +14,11 @@ test("callback page sends provided code", () => {
 
     render(<CallbackPage/>);
 
-    expect(global.opener.postMessage).toBeCalledTimes(1);
-    expect(global.opener.postMessage).toBeCalledWith({
-        code: "abcde_code",
-        state: "abcde_state"
+    await waitFor(() => {
+        expect(global.opener.postMessage).toBeCalledTimes(1);
+        expect(global.opener.postMessage).toBeCalledWith({
+            code: "abcde_code",
+            state: "abcde_state"
+        });
     });
 });
-- 
cgit v1.2.3

