Skip to content

Commit

Permalink
Add test for adding neutral classification
Browse files Browse the repository at this point in the history
  • Loading branch information
koesie10 committed Oct 12, 2023
1 parent b6eb383 commit bcceae4
Showing 1 changed file with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,47 @@ describe(MultipleModeledMethodsPanel.name, () => {
},
]);
});

it("shows an error when adding a neutral modeling", async () => {
const { rerender } = render({
method,
modeledMethods,
onChange,
});

await userEvent.click(screen.getByLabelText("Add modeling"));

rerender(
<MultipleModeledMethodsPanel
method={method}
modeledMethods={
onChange.mock.calls[onChange.mock.calls.length - 1][0]
}
onChange={onChange}
/>,
);

const modelTypeDropdown = screen.getByRole("combobox", {
name: "Model type",
});

await userEvent.selectOptions(modelTypeDropdown, "neutral");

rerender(
<MultipleModeledMethodsPanel
method={method}
modeledMethods={
onChange.mock.calls[onChange.mock.calls.length - 1][0]
}
onChange={onChange}
/>,
);

expect(screen.getByRole("alert")).toBeInTheDocument();
expect(
screen.getByText("Error: Conflicting classification"),
).toBeInTheDocument();
});
});

describe("with three modeled methods", () => {
Expand Down

0 comments on commit bcceae4

Please sign in to comment.