Skip to content

Commit

Permalink
Comments from review :)
Browse files Browse the repository at this point in the history
  • Loading branch information
spong committed Feb 12, 2020
1 parent 363b340 commit 1dc2c04
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ describe('body', () => {

const mockHostDetailsPageFilters = getHostDetailsPageFilters('host-1');

const filterQuery = JSON.stringify({
bool: {
must: [],
filter: [{ match_all: {} }, { match_phrase: { 'host.name': { query: 'host-1' } } }],
should: [],
must_not: [],
},
});

const componentProps: Record<string, Partial<HostDetailsTabsProps>> = {
events: { pageFilters: mockHostDetailsPageFilters },
alerts: { pageFilters: mockHostDetailsPageFilters },
Expand All @@ -69,7 +78,7 @@ describe('body', () => {
indexPattern={mockIndexPattern}
type={type}
pageFilters={mockHostDetailsPageFilters}
filterQuery='{"bool":{"must":[],"filter":[{"match_all":{}},{"match_phrase":{"host.name":{"query":"host-1"}}}],"should":[],"must_not":[]}}'
filterQuery={filterQuery}
/>
</MemoryRouter>
</TestProviders>
Expand All @@ -78,8 +87,7 @@ describe('body', () => {
// match against everything but the functions to ensure they are there as expected
expect(wrapper.find(componentName).props()).toMatchObject({
endDate: 0,
filterQuery:
'{"bool":{"must":[],"filter":[{"match_all":{}},{"match_phrase":{"host.name":{"query":"host-1"}}}],"should":[],"must_not":[]}}',
filterQuery,
skip: false,
startDate: 0,
type: 'details',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import { getHostDetailsEventsKqlQueryExpression, getHostDetailsPageFilters } from './helpers';
import { esFilters } from '../../../../../../../../src/plugins/data/common/es_query';

describe('hosts page helpers', () => {
describe('getHostDetailsEventsKqlQueryExpression', () => {
Expand Down Expand Up @@ -38,7 +39,7 @@ describe('hosts page helpers', () => {

describe('getHostDetailsPageFilters', () => {
it('correctly constructs pageFilters for the given hostName', () => {
expect(getHostDetailsPageFilters('host-1')).toEqual([
const expected: esFilters.Filter[] = [
{
meta: {
alias: null,
Expand All @@ -60,7 +61,8 @@ describe('hosts page helpers', () => {
},
},
},
]);
];
expect(getHostDetailsPageFilters('host-1')).toEqual(expected);
});
});
});

0 comments on commit 1dc2c04

Please sign in to comment.