Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Add delete actions UT and fix snapshots #235

Merged
merged 1 commit into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ describe('<ListActions /> spec', () => {
const defaultProps = {
onStartDetectors: jest.fn(),
onStopDetectors: jest.fn(),
onDeleteDetectors: jest.fn(),
detectors: [],
isActionsDisabled: true,
isStartDisabled: false,
isStopDisabled: false,
};
describe('List actions', () => {
console.error = jest.fn();
Expand All @@ -43,7 +46,7 @@ describe('<ListActions /> spec', () => {
const { getByTestId } = render(
<ListActions {...defaultProps} isActionsDisabled={false} />
);
fireEvent.click(getByTestId('actionsButton'));
fireEvent.click(getByTestId('listActionsButton'));
await wait();
fireEvent.click(getByTestId('startDetectors'));
expect(defaultProps.onStartDetectors).toHaveBeenCalled();
Expand All @@ -52,10 +55,19 @@ describe('<ListActions /> spec', () => {
const { getByTestId } = render(
<ListActions {...defaultProps} isActionsDisabled={false} />
);
fireEvent.click(getByTestId('actionsButton'));
fireEvent.click(getByTestId('listActionsButton'));
await wait();
fireEvent.click(getByTestId('stopDetectors'));
expect(defaultProps.onStopDetectors).toHaveBeenCalled();
});
test('should call onDeleteDetectors when clicking on delete action', async () => {
const { getByTestId } = render(
<ListActions {...defaultProps} isActionsDisabled={false} />
);
fireEvent.click(getByTestId('listActionsButton'));
await wait();
fireEvent.click(getByTestId('deleteDetectors'));
expect(defaultProps.onDeleteDetectors).toHaveBeenCalled();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports[`<ListActions /> spec List actions renders component when disabled 1`] =
>
<button
class="euiButton euiButton--primary euiButton--iconRight"
data-test-subj="actionsButton"
data-test-subj="listActionsButton"
disabled=""
type="button"
>
Expand Down Expand Up @@ -64,7 +64,7 @@ exports[`<ListActions /> spec List actions renders component when enabled 1`] =
>
<button
class="euiButton euiButton--primary euiButton--iconRight"
data-test-subj="actionsButton"
data-test-subj="listActionsButton"
type="button"
>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ exports[`<ListFilters /> spec Empty results renders component with empty message
aria-expanded="false"
aria-haspopup="listbox"
class="euiComboBox euiComboBox--fullWidth"
data-test-subj="detectorStateFilter"
role="combobox"
>
<div
Expand Down Expand Up @@ -116,6 +117,7 @@ exports[`<ListFilters /> spec Empty results renders component with empty message
aria-expanded="false"
aria-haspopup="listbox"
class="euiComboBox euiComboBox--fullWidth"
data-test-subj="indicesFilter"
role="combobox"
>
<div
Expand Down