aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/pages/LandingPage.test.tsx
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2022-07-14 09:12:52 +0400
committerGravatar Hassan Abouelela <[email protected]>2022-07-14 09:12:52 +0400
commit83ad168cfe0f5865c4538e0b9bb98173e0c0a07e (patch)
tree6ec8abaa2b055913f25ab2525ca6513d3897a8a6 /src/tests/pages/LandingPage.test.tsx
parentBump @swc/core from 1.2.204 to 1.2.213 (diff)
Wrap Tests In Act
Wrap the tests that were raising warnings in act statements. Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'src/tests/pages/LandingPage.test.tsx')
-rw-r--r--src/tests/pages/LandingPage.test.tsx15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/tests/pages/LandingPage.test.tsx b/src/tests/pages/LandingPage.test.tsx
index 727b922..b2a5142 100644
--- a/src/tests/pages/LandingPage.test.tsx
+++ b/src/tests/pages/LandingPage.test.tsx
@@ -1,11 +1,11 @@
import React from "react";
-import { render, waitFor } from "@testing-library/react";
+import {act, render, screen} from "@testing-library/react";
import LandingPage from "../../pages/LandingPage";
import * as forms from "../../api/forms";
-import { MemoryRouter } from "react-router-dom";
-import { QuestionType } from "../../api/question";
+import {MemoryRouter} from "react-router-dom";
+import {QuestionType} from "../../api/question";
const testingForm: forms.Form = {
"id": "testing-form",
@@ -27,10 +27,7 @@ const testingForm: forms.Form = {
test("renders landing page", async () => {
jest.spyOn(forms, "getForms").mockImplementation(() => Promise.resolve([testingForm]));
-
- const { getByText } = render(<LandingPage/>, {wrapper: MemoryRouter});
- await waitFor(() => {
- const headerBar = getByText(/Python Discord Forms/);
- expect(headerBar).toBeInTheDocument();
- });
+ act(() => { render(<LandingPage/>, {wrapper: MemoryRouter}); });
+ const headerBar = await screen.findByText(/Python Discord Forms/);
+ expect(headerBar).toBeInTheDocument();
});