-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
314 additions
and
13 deletions.
There are no files selected for viewing
107 changes: 107 additions & 0 deletions
107
.../public/classes/layers/choropleth_layer_wizard/__snapshots__/layer_template.test.tsx.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
42 changes: 42 additions & 0 deletions
42
x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/layer_template.test.tsx
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,42 @@ | ||
/* | ||
* 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', () => { | ||
const MockIndexPatternSelect = (props: unknown) => { | ||
return <div />; | ||
}; | ||
return { | ||
getIndexPatternSelectComponent: () => { | ||
return MockIndexPatternSelect; | ||
}, | ||
}; | ||
}); | ||
|
||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { BOUNDARIES_SOURCE, LayerTemplate } from './layer_template'; | ||
|
||
const renderWizardArguments = { | ||
previewLayers: () => {}, | ||
mapColors: [], | ||
isIndexingTriggered: false, | ||
onRemove: () => {}, | ||
onIndexReady: () => {}, | ||
importSuccessHandler: () => {}, | ||
importErrorHandler: () => {}, | ||
}; | ||
|
||
test('should render elasticsearch UI when left source is BOUNDARIES_SOURCE.ELASTICSEARCH', async () => { | ||
const component = shallow(<LayerTemplate {...renderWizardArguments} />); | ||
component.setState({ leftSource: BOUNDARIES_SOURCE.ELASTICSEARCH }); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
|
||
test('should render EMS UI when left source is BOUNDARIES_SOURCE.EMS', async () => { | ||
const component = shallow(<LayerTemplate {...renderWizardArguments} />); | ||
component.setState({ leftSource: BOUNDARIES_SOURCE.EMS }); | ||
expect(component).toMatchSnapshot(); | ||
}); |
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
104 changes: 104 additions & 0 deletions
104
x-pack/plugins/maps/public/components/__snapshots__/geo_index_pattern_select.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
x-pack/plugins/maps/public/components/geo_index_pattern_select.test.tsx
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,42 @@ | ||
/* | ||
* 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', () => { | ||
const MockIndexPatternSelect = (props: unknown) => { | ||
return <div />; | ||
}; | ||
const MockHttp = { | ||
basePath: { | ||
prepend: (path: string) => { | ||
return `abc/${path}`; | ||
}, | ||
}, | ||
}; | ||
return { | ||
getIndexPatternSelectComponent: () => { | ||
return MockIndexPatternSelect; | ||
}, | ||
getHttp: () => { | ||
return MockHttp; | ||
}, | ||
}; | ||
}); | ||
|
||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { GeoIndexPatternSelect } from './geo_index_pattern_select'; | ||
|
||
test('should render', async () => { | ||
const component = shallow(<GeoIndexPatternSelect onChange={() => {}} value={'indexPatternId'} />); | ||
|
||
expect(component).toMatchSnapshot(); | ||
}); | ||
|
||
test('should render no index pattern warning when there are no matching index patterns', async () => { | ||
const component = shallow(<GeoIndexPatternSelect onChange={() => {}} value={'indexPatternId'} />); | ||
component.setState({ noGeoIndexPatternsExist: true }); | ||
expect(component).toMatchSnapshot(); | ||
}); |