Skip to content

Commit

Permalink
Modify example unit test revision for specificity.
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkambic committed Jan 11, 2021
1 parent 5ade268 commit 9728d3a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,23 @@
*/

import React from 'react';
import { render } from '../../../lib';
import { render } from '../../../lib/helper/component_test_helpers';
import { MLJobLink } from './ml_job_link';

describe('ML JobLink', () => {
it('renders without errors', () => {
const { asFragment } = render(
<MLJobLink dateRange={{ to: '', from: '' }} basePath="" monitorId="testMonitor" />,
const expectedHref = `/app/ml#/explorer?_g=(ml:(jobIds:!(testmonitor_high_latency_by_geo)),refreshInterval:(pause:!t,value:0),time:(from:'',to:''))&_a=(mlExplorerFilter:(filterActive:!t,filteredFields:!(monitor.id,testMonitor)),mlExplorerSwimlane:(viewByFieldName:observer.geo.name))`;
const { getByRole, getByText } = render(
<MLJobLink dateRange={{ to: '', from: '' }} basePath="" monitorId="testMonitor">
<div>Test link</div>
</MLJobLink>,
{
coreOptions: { triggersActionsUi: { getEditAlertFlyout: jest.fn() } },
}
);
expect(asFragment()).toMatchSnapshot();

const jobLink = getByRole('link');
expect(jobLink.getAttribute('href')).toBe(expectedHref);
expect(getByText('Test link'));
});
});

0 comments on commit 9728d3a

Please sign in to comment.