Skip to content

Commit

Permalink
[ML] add unit test for callout
Browse files Browse the repository at this point in the history
  • Loading branch information
darnautov committed Oct 8, 2020
1 parent c0b3703 commit 9f92b80
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import React from 'react';
import { I18nProvider } from '@kbn/i18n/react';
import { fireEvent, render } from '@testing-library/react'; // eslint-disable-line import/no-extraneous-dependencies
import { JobSelectorTable } from './job_selector_table';

Expand Down Expand Up @@ -120,6 +121,19 @@ describe('JobSelectorTable', () => {
});

describe('Not Single Selection', () => {
test('renders callout when no jobs provided', () => {
const propsEmptyJobs = { ...props, jobs: [], groupsList: [] };
const { getByText } = render(
<I18nProvider>
<JobSelectorTable {...propsEmptyJobs} />
</I18nProvider>
);
const calloutMessage = getByText('No anomaly detection jobs found');
const createJobButton = getByText('Create job');
expect(createJobButton).toBeDefined();
expect(calloutMessage).toBeDefined();
});

test('renders tabs when not singleSelection', () => {
const { getAllByRole } = render(<JobSelectorTable {...props} />);
const tabs = getAllByRole('tab');
Expand Down

0 comments on commit 9f92b80

Please sign in to comment.