From 1dc2c046e2afbcb1576ed0ed193085077a1c314b Mon Sep 17 00:00:00 2001 From: Garrett Spong Date: Tue, 11 Feb 2020 18:33:04 -0700 Subject: [PATCH] Comments from review :) --- .../pages/hosts/details/details_tabs.test.tsx | 14 +++++++++++--- .../public/pages/hosts/details/helpers.test.ts | 6 ++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.test.tsx b/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.test.tsx index b6953e371e256..30955ed8ccb57 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.test.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.test.tsx @@ -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> = { events: { pageFilters: mockHostDetailsPageFilters }, alerts: { pageFilters: mockHostDetailsPageFilters }, @@ -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} /> @@ -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', diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/details/helpers.test.ts b/x-pack/legacy/plugins/siem/public/pages/hosts/details/helpers.test.ts index 908cce70bea9b..747bf9bc7e56d 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/details/helpers.test.ts +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/details/helpers.test.ts @@ -5,6 +5,7 @@ */ import { getHostDetailsEventsKqlQueryExpression, getHostDetailsPageFilters } from './helpers'; +import { esFilters } from '../../../../../../../../src/plugins/data/common/es_query'; describe('hosts page helpers', () => { describe('getHostDetailsEventsKqlQueryExpression', () => { @@ -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, @@ -60,7 +61,8 @@ describe('hosts page helpers', () => { }, }, }, - ]); + ]; + expect(getHostDetailsPageFilters('host-1')).toEqual(expected); }); }); });