-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add jest test for es docs source UpdateSourceEditor component
- Loading branch information
Showing
3 changed files
with
349 additions
and
2 deletions.
There are no files selected for viewing
292 changes: 292 additions & 0 deletions
292
...ps/public/layers/sources/es_search_source/__snapshots__/update_source_editor.test.js.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...k/legacy/plugins/maps/public/layers/sources/es_search_source/update_source_editor.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
jest.mock('../../../kibana_services', () => ({})); | ||
|
||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import { UpdateSourceEditor } from './update_source_editor'; | ||
|
||
const defaultProps = { | ||
indexPatternId: 'indexPattern1', | ||
onChange: () => {}, | ||
filterByMapBounds: true, | ||
tooltipProperties: [], | ||
sortOrder: 'DESC', | ||
useTopHits: false, | ||
topHitsSplitField: 'trackId', | ||
topHitsSize: 1, | ||
}; | ||
|
||
test('should render update source editor', async () => { | ||
const component = shallow( | ||
<UpdateSourceEditor | ||
{...defaultProps} | ||
/> | ||
); | ||
|
||
expect(component).toMatchSnapshot(); | ||
}); | ||
|
||
test('should enable sort order select when sort field provided', async () => { | ||
const component = shallow( | ||
<UpdateSourceEditor | ||
{...defaultProps} | ||
sortField="@timestamp" | ||
/> | ||
); | ||
|
||
expect(component).toMatchSnapshot(); | ||
}); | ||
|
||
test('should render top hits form when useTopHits is true', async () => { | ||
const component = shallow( | ||
<UpdateSourceEditor | ||
{...defaultProps} | ||
useTopHits={true} | ||
/> | ||
); | ||
|
||
expect(component).toMatchSnapshot(); | ||
}); |