forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] Fix setting the initial Kibana filters (elastic#7…
…5215) (elastic#75751) * [Security Solution] Fix setting the initial Kibana filters * add unit test * keep appState in kibana storage * fix logic Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
- Loading branch information
1 parent
8c2b0ef
commit 0743648
Showing
3 changed files
with
93 additions
and
29 deletions.
There are no files selected for viewing
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
44 changes: 44 additions & 0 deletions
44
x-pack/plugins/security_solution/public/common/components/search_bar/index.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,44 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
|
||
import { InputsModelId } from '../../store/inputs/constants'; | ||
import { SearchBarComponent } from '.'; | ||
import { TestProviders } from '../../mock'; | ||
|
||
jest.mock('../../lib/kibana'); | ||
|
||
describe('SearchBarComponent', () => { | ||
const props = { | ||
id: 'global' as InputsModelId, | ||
indexPattern: { | ||
fields: [], | ||
title: '', | ||
}, | ||
updateSearch: jest.fn(), | ||
setSavedQuery: jest.fn(), | ||
setSearchBarFilter: jest.fn(), | ||
end: '', | ||
start: '', | ||
toStr: '', | ||
fromStr: '', | ||
isLoading: false, | ||
filterQuery: { | ||
query: '', | ||
language: '', | ||
}, | ||
queries: [], | ||
savedQuery: undefined, | ||
}; | ||
|
||
it('calls setSearchBarFilter on mount', () => { | ||
mount(<SearchBarComponent {...props} />, { wrappingComponent: TestProviders }); | ||
|
||
expect(props.setSearchBarFilter).toHaveBeenCalled(); | ||
}); | ||
}); |
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