Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierM committed Jan 14, 2020
1 parent 1246b02 commit 1630791
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ describe('helpers', () => {
description: '',
deletedEventIds: [],
eventIdToNoteIds: {},
eventType: 'raw',
filters: [],
highlightedDropAndProviderId: '',
historyIds: [],
Expand Down Expand Up @@ -329,6 +330,7 @@ describe('helpers', () => {
description: '',
deletedEventIds: [],
eventIdToNoteIds: {},
eventType: 'raw',
filters: [],
highlightedDropAndProviderId: '',
historyIds: [],
Expand Down Expand Up @@ -415,6 +417,7 @@ describe('helpers', () => {
description: '',
deletedEventIds: [],
eventIdToNoteIds: {},
eventType: 'raw',
filters: [],
highlightedDropAndProviderId: '',
historyIds: [],
Expand Down Expand Up @@ -536,6 +539,7 @@ describe('helpers', () => {
description: '',
deletedEventIds: [],
eventIdToNoteIds: {},
eventType: 'raw',
filters: [
{
$state: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import React, { useEffect, useRef, useState, useCallback, useMemo } from 'react';
import React, { useEffect, useRef, useState, useCallback } from 'react';
import uuid from 'uuid';
import VisibilitySensor from 'react-visibility-sensor';

Expand Down
13 changes: 7 additions & 6 deletions x-pack/legacy/plugins/siem/public/containers/timeline/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { getOr } from 'lodash/fp';
import { getOr, isEmpty } from 'lodash/fp';
import memoizeOne from 'memoize-one';
import React from 'react';
import { Query } from 'react-apollo';
Expand Down Expand Up @@ -81,17 +81,18 @@ class TimelineQueryComponent extends QueryTemplate<
sourceId,
sortField,
} = this.props;

// I needed to do that to avoid test to yell at me since there is no good way yet to mock withKibana
const defaultKibanaIndex = kibana.services.uiSettings.get<string[]>(DEFAULT_INDEX_KEY) ?? [];
const defaultIndex = isEmpty(indexPattern)
? [...defaultKibanaIndex, ...indexToAdd]
: indexPattern?.title.split(',') ?? [];
const variables: GetTimelineQuery.Variables = {
fieldRequested: fields,
filterQuery: createFilter(filterQuery),
sourceId,
pagination: { limit, cursor: null, tiebreaker: null },
sortField,
defaultIndex: indexPattern?.title.split(',') ?? [
...kibana.services.uiSettings.get<string[]>(DEFAULT_INDEX_KEY),
...indexToAdd,
],
defaultIndex,
inspect: isInspected,
};
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ export const mockTableData: TableData[] = [
updated_by: 'elastic',
version: 1,
},
status: null,
statusDate: null,
tags: [],
},
{
Expand Down Expand Up @@ -149,6 +151,8 @@ export const mockTableData: TableData[] = [
updated_by: 'elastic',
version: 1,
},
status: null,
statusDate: null,
tags: [],
},
];
2 changes: 2 additions & 0 deletions x-pack/legacy/plugins/siem/public/store/timeline/epic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ describe('Epic Timeline', () => {
deletedEventIds: [],
description: '',
eventIdToNoteIds: {},
eventType: 'all',
highlightedDropAndProviderId: '',
historyIds: [],
filters: [
Expand Down Expand Up @@ -227,6 +228,7 @@ describe('Epic Timeline', () => {
start: 1572469587644,
},
description: '',
eventType: 'all',
filters: [
{
exists: null,
Expand Down

0 comments on commit 1630791

Please sign in to comment.