Skip to content

Commit

Permalink
Add waitFor to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro-Vega committed Nov 5, 2024
1 parent efdb01f commit b12f2ba
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions src/components/DataSubmissions/DataSubmissionListFilters.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -813,13 +813,12 @@ describe("DataSubmissionListFilters Component", () => {

await waitFor(() => {
expect(getByTestId("data-commons-select-input")).toHaveValue("DataCommon1");
expect(mockOnChange).toHaveBeenCalledWith(
expect.objectContaining({
dataCommons: "DataCommon1",
})
);
});

expect(mockOnChange).toHaveBeenCalledWith(
expect.objectContaining({
dataCommons: "DataCommon1",
})
);
});

it("sets submitterNames select to 'All' when submitterNames prop is empty", async () => {
Expand Down Expand Up @@ -896,13 +895,12 @@ describe("DataSubmissionListFilters Component", () => {

await waitFor(() => {
expect(getByTestId("submitter-name-select-input")).toHaveValue("Submitter1");
expect(mockOnChange).toHaveBeenCalledWith(
expect.objectContaining({
submitterName: "Submitter1",
})
);
});

expect(mockOnChange).toHaveBeenCalledWith(
expect.objectContaining({
submitterName: "Submitter1",
})
);
});

it("sets organization select to 'All' when organizations prop is empty", async () => {
Expand Down Expand Up @@ -975,12 +973,11 @@ describe("DataSubmissionListFilters Component", () => {

await waitFor(() => {
expect(getByTestId("organization-select-input")).toHaveValue("Org1");
expect(mockOnChange).toHaveBeenCalledWith(
expect.objectContaining({
organization: "Org1",
})
);
});

expect(mockOnChange).toHaveBeenCalledWith(
expect.objectContaining({
organization: "Org1",
})
);
});
});

0 comments on commit b12f2ba

Please sign in to comment.