Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
khushiagl committed Jul 31, 2023
1 parent db49cf0 commit 1f20110
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ describe("Criteria Filter", () => {
],
onMinChange: jest.fn().mockImplementation(() => null),
onMaxChange: jest.fn().mockImplementation(() => null),
addCriterion: jest.fn().mockImplementation(() => null),
removeCriterion: jest.fn().mockImplementation(() => null),
onAddCriterion: jest.fn().mockImplementation(() => null),
onDeleteCriterion: jest.fn().mockImplementation(() => null),
};

beforeEach(() => {
Expand Down Expand Up @@ -85,7 +85,7 @@ describe("Criteria Filter", () => {

//add criterion
fireEvent.click(button);
expect(props.addCriterion).toHaveBeenCalledWith({name: "e"});
expect(props.onAddCriterion).toHaveBeenCalledWith({name: "e"});
});
});

Expand Down Expand Up @@ -114,14 +114,14 @@ describe("Criteria Filter", () => {
});

describe("when deleting a criterion", () => {
it("should remove the criterion", () => {
it("should delete the criterion", () => {
const listItems = screen.getAllByRole("listitem");
const listItem = listItems[0];
const xmark = within(listItem).getByTestId("remove-criterion");

fireEvent.click(xmark);

expect(props.removeCriterion).toHaveBeenCalledWith("a");
expect(props.onDeleteCriterion).toHaveBeenCalledWith("a");
});
});
});

0 comments on commit 1f20110

Please sign in to comment.