Skip to content

Commit a8fdf1d

Browse files
committed
fix: existing test failing due to carbon update
1 parent 346e512 commit a8fdf1d

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

frontend/src/__test__/components/Dashboard/OpeningSubmissionTrend.test.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
act,
88
within,
99
} from "@testing-library/react";
10+
import userEvent from "@testing-library/user-event";
1011
import { describe, it, expect, vi, beforeEach } from "vitest";
1112
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
1213
import OpeningSubmissionTrend from "../../../components/OpeningSubmissionTrend";
@@ -168,6 +169,7 @@ describe("OpeningSubmissionTrend Component", () => {
168169
});
169170

170171
it("should update org units and trigger data fetch", async () => {
172+
const user = userEvent.setup();
171173
(
172174
API.UserActionsEndpointService.getOpeningsSubmissionTrends as vi.Mock
173175
).mockResolvedValueOnce([]);
@@ -185,16 +187,21 @@ describe("OpeningSubmissionTrend Component", () => {
185187
expect(within(container!).getByText("District")).toBeInTheDocument();
186188
});
187189

190+
// Find the FilterableMultiSelect input field
188191
const districtInput = document.getElementById(
189192
"district-dropdown-input"
190193
) as HTMLInputElement;
191194
expect(districtInput).toBeInTheDocument();
192195

193-
fireEvent.change(districtInput, { target: { value: "District A" } });
196+
// Click on the input to open the menu
197+
await user.click(districtInput);
194198

195-
expect(
196-
screen.getByRole("option", { name: "DAS - District A" })
197-
).toBeInTheDocument();
199+
// Wait for and verify the option appears
200+
await waitFor(() => {
201+
expect(
202+
screen.getByRole("option", { name: "DAS - District A" })
203+
).toBeInTheDocument();
204+
});
198205
});
199206

200207
it("should show loading spinner when fetching", async () => {

0 commit comments

Comments
 (0)