Skip to content

Commit

Permalink
refactor: remove redundant waitFor
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-Heneghan committed Feb 26, 2024
1 parent 7a484a5 commit c4c57f1
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions editor.planx.uk/src/components/Feedback/FeedbackForm.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { waitFor } from "@testing-library/react";
import React from "react";
import { axe, setup } from "testUtils";

Expand Down Expand Up @@ -75,14 +74,12 @@ describe("FeedbackForm functionality", () => {
);
await user.click(getByText("Send feedback"));

await waitFor(() => {
expect(mockHandleSubmit).toHaveBeenCalledWith(
expect.objectContaining({
userComment: "This is a test comment",
}),
expect.any(Object),
);
});
expect(mockHandleSubmit).toHaveBeenCalledWith(
expect.objectContaining({
userComment: "This is a test comment",
}),
expect.any(Object),
);
});

test("can submit labelled inputs", async () => {
Expand All @@ -95,18 +92,15 @@ describe("FeedbackForm functionality", () => {

await user.type(getByLabelText("User Context"), "This is test context");
await user.type(getByLabelText("User Comment"), "This is a test comment");

await user.click(getByText("Send feedback"));

await waitFor(() => {
expect(mockHandleSubmit).toHaveBeenCalledWith(
expect.objectContaining({
userContext: "This is test context",
userComment: "This is a test comment",
}),
expect.any(Object),
);
});
expect(mockHandleSubmit).toHaveBeenCalledWith(
expect.objectContaining({
userContext: "This is test context",
userComment: "This is a test comment",
}),
expect.any(Object),
);
});
});

Expand Down

0 comments on commit c4c57f1

Please sign in to comment.