mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Add missing tests for curation panel refresh buttons (#130912)
This commit is contained in:
parent
6d9a7ce4c8
commit
2ba68e7edc
3 changed files with 48 additions and 1 deletions
|
@ -9,8 +9,14 @@ import React from 'react';
|
|||
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { EuiButtonEmpty } from '@elastic/eui';
|
||||
|
||||
import { nextTick } from '@kbn/test-jest-helpers';
|
||||
|
||||
import { EntSearchLogStream } from '../../../../shared/log_stream';
|
||||
|
||||
import { DataPanel } from '../../data_panel';
|
||||
|
||||
import { AutomatedCurationHistory } from './automated_curation_history';
|
||||
|
||||
describe('AutomatedCurationHistory', () => {
|
||||
|
@ -20,4 +26,17 @@ describe('AutomatedCurationHistory', () => {
|
|||
'appsearch.adaptive_relevance.query: some text and event.kind: event and event.dataset: search-relevance-suggestions and appsearch.adaptive_relevance.engine: foo and event.action: curation_suggestion and appsearch.adaptive_relevance.suggestion.new_status: automated'
|
||||
);
|
||||
});
|
||||
|
||||
it('sets new endTimestamp when refresh is pressed', async () => {
|
||||
const wrapper = shallow(<AutomatedCurationHistory engineName="foo" query="some text" />);
|
||||
const initialTimestamp = wrapper.find(EntSearchLogStream).prop('endTimestamp');
|
||||
await nextTick();
|
||||
|
||||
// Find the refresh button and click
|
||||
shallow(wrapper.find(DataPanel).prop('title')).find(EuiButtonEmpty).simulate('click');
|
||||
|
||||
wrapper.update();
|
||||
|
||||
expect(wrapper.find(EntSearchLogStream).prop('endTimestamp')).not.toEqual(initialTimestamp);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -13,6 +13,10 @@ import React from 'react';
|
|||
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { EuiButtonEmpty } from '@elastic/eui';
|
||||
|
||||
import { nextTick } from '@kbn/test-jest-helpers';
|
||||
|
||||
import { EntSearchLogStream } from '../../../../../../shared/log_stream';
|
||||
import { DataPanel } from '../../../../data_panel';
|
||||
|
||||
|
@ -32,4 +36,17 @@ describe('AutomatedCurationsHistoryPanel', () => {
|
|||
'event.kind: event and event.dataset: search-relevance-suggestions and appsearch.adaptive_relevance.engine: some-engine and event.action: curation_suggestion and appsearch.adaptive_relevance.suggestion.new_status: automated'
|
||||
);
|
||||
});
|
||||
|
||||
it('sets new endTimestamp when refresh is pressed', async () => {
|
||||
const wrapper = shallow(<AutomatedCurationsHistoryPanel />);
|
||||
const initialTimestamp = wrapper.find(EntSearchLogStream).prop('endTimestamp');
|
||||
await nextTick();
|
||||
|
||||
// Find the refresh button and click
|
||||
shallow(wrapper.find(DataPanel).prop('title')).find(EuiButtonEmpty).simulate('click');
|
||||
|
||||
wrapper.update();
|
||||
|
||||
expect(wrapper.find(EntSearchLogStream).prop('endTimestamp')).not.toEqual(initialTimestamp);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -15,7 +15,9 @@ import React from 'react';
|
|||
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { EuiBasicTable } from '@elastic/eui';
|
||||
import { EuiBasicTable, EuiButtonEmpty } from '@elastic/eui';
|
||||
|
||||
import { DataPanel } from '../../../../../data_panel';
|
||||
|
||||
import { IgnoredQueriesPanel } from './ignored_queries_panel';
|
||||
|
||||
|
@ -91,4 +93,13 @@ describe('IgnoredQueriesPanel', () => {
|
|||
|
||||
expect(mockActions.onPaginate).toHaveBeenCalledWith(1);
|
||||
});
|
||||
|
||||
it('fetches data on refresh button press', () => {
|
||||
const wrapper = shallow(<IgnoredQueriesPanel />);
|
||||
expect(mockActions.loadIgnoredQueries).toHaveBeenCalledTimes(1);
|
||||
|
||||
shallow(wrapper.find(DataPanel).prop('title')).find(EuiButtonEmpty).simulate('click');
|
||||
|
||||
expect(mockActions.loadIgnoredQueries).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue