Skip to content

Commit

Permalink
fix and enable commented-out ParentSelector test
Browse files Browse the repository at this point in the history
  • Loading branch information
edchapman88 committed Jan 23, 2024
1 parent 98b5c26 commit 09113cc
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions frontend/src/components/tests/ParentSelector.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,14 @@ test("renders options based on API response", async () => {
expect(option2).toBeInTheDocument();
});

// TODO: Get this test to work
// test("onChange updates selected value correctly", () => {
// const setValueMock = jest.fn();
// render(<ParentSelector type="Evidence" setValue={setValueMock} />);
// const dropdown = screen.getByPlaceholderText("Choose a parent");
// fireEvent.click(dropdown);
test("onChange updates selected value correctly", async () => {
const setValueMock = jest.fn();
render(<ParentSelector type="Evidence" setValue={setValueMock} />);
const dropdown = await screen.findByLabelText("Choose a parent");
userEvent.click(dropdown);

// const option = screen.findByText("PropertyClaim 1");;
// fireEvent.click(option);
const option = await screen.findByText("PropertyClaim 1");;
userEvent.click(option);

// expect(setValueMock).toHaveBeenCalledWith({ id: 1, name: "PropertyClaim 1" });
// });
expect(setValueMock).toHaveBeenCalledWith({ id: 1, name: "PropertyClaim 1" });
});

0 comments on commit 09113cc

Please sign in to comment.