Skip to content

Commit

Permalink
refactor(alert): add more test
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasmenker committed Nov 5, 2020
1 parent 9603f24 commit 0495790
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/components/Alert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,14 @@ describe('<Alert>', () => {
fireEvent.click(buttonClose);
expect(container.firstChild).toBeNull();
});
it('Should call onClose event', () => {
const mockCallBack = jest.fn();
const messageText = "Warning Tips";
const { getByTestId } = render(
<Alert message={messageText} type="warning" closable onClose={mockCallBack}/>
);
const buttonClose = getByTestId('alert-icon-close');
fireEvent.click(buttonClose);
expect(mockCallBack).toHaveBeenCalled();
});
});

0 comments on commit 0495790

Please sign in to comment.