Skip to content

Commit

Permalink
cleanup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TangoYankee committed Aug 21, 2024
1 parent 72b1dca commit 7ade2c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions app/components/AdminDropdown/BoroughDropdown.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Borough, createBorough } from "~/gen";
import { BoroughDropdown } from "./BoroughDropdown";
import { render, screen } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { act } from "react";

describe("BoroughDropdown", () => {
let boroughs: Array<Borough> = [];
Expand Down Expand Up @@ -33,7 +34,7 @@ describe("BoroughDropdown", () => {
/>,
);

await userEvent.selectOptions(screen.getByRole("combobox"), "");
await act(() => userEvent.selectOptions(screen.getByRole("combobox"), ""));
expect(updateSearchParams).toHaveBeenCalledWith({
districtType: "cd",
});
Expand All @@ -49,7 +50,9 @@ describe("BoroughDropdown", () => {
/>,
);

await userEvent.selectOptions(screen.getByRole("combobox"), firstBoroughId);
await act(() =>
userEvent.selectOptions(screen.getByRole("combobox"), firstBoroughId),
);
expect(updateSearchParams).toHaveBeenCalledWith({
districtType: "cd",
boroughId: firstBoroughId,
Expand Down
4 changes: 2 additions & 2 deletions app/components/AdminDropdown/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe("AdminDropdown", () => {
expect(testSelect?.selected).toBe(true);
});

it("should call function when form label is clicked", () => {
it("should call function when form label is clicked", async () => {
const onFormLabelClick = vi.fn();

render(
Expand All @@ -65,7 +65,7 @@ describe("AdminDropdown", () => {
</AdminDropdown>,
);

fireEvent.click(screen.getByText("Test Boundary"));
await act(() => fireEvent.click(screen.getByText("Test Boundary")));
expect(onFormLabelClick).toHaveBeenCalled();
});

Expand Down
2 changes: 1 addition & 1 deletion app/components/MobilePanelResizeBar.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fireEvent, render, screen } from "@testing-library/react";
import { MobilePanelResizeBar } from "./MobilePanelResizeBar";

describe("MobilePanelSizeControl", () => {
describe("MobilePanelResizeBar", () => {
it("should have be clickable to expand", async () => {
const isExpanded = false;
const isExpandedToggle = vi.fn();
Expand Down

0 comments on commit 7ade2c2

Please sign in to comment.