Skip to content

Commit

Permalink
Merge branch 'master' into upgrade-lodash-4-final
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Jul 1, 2020
2 parents 755166e + c1dc53c commit 912793c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jest.mock('../../../../common/lib/kibana', () => {
useKibana: jest.fn().mockReturnValue({
services: {
application: {
navigateToApp: jest.fn(),
navigateToApp: () => Promise.resolve(),
capabilities: {
siem: {
crud: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,21 @@ export const NewCase = React.memo<NewCaseProps>(

const handleClick = useCallback(() => {
onClosePopover();
dispatch(
setInsertTimeline({
graphEventId,
timelineId,
timelineSavedObjectId: savedObjectId,
timelineTitle: timelineTitle.length > 0 ? timelineTitle : i18n.UNTITLED_TIMELINE,
})
);

dispatch(showTimeline({ id: TimelineId.active, show: false }));

navigateToApp(`${APP_ID}:${SecurityPageName.case}`, {
path: getCreateCaseUrl(),
});
}).then(() =>
dispatch(
setInsertTimeline({
graphEventId,
timelineId,
timelineSavedObjectId: savedObjectId,
timelineTitle: timelineTitle.length > 0 ? timelineTitle : i18n.UNTITLED_TIMELINE,
})
)
);
}, [
dispatch,
graphEventId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { act } from 'react-dom/test-utils';

jest.mock('../../../../common/components/link_to');

const mockNavigateToApp = jest.fn();
const mockNavigateToApp = jest.fn().mockImplementation(() => Promise.resolve());
jest.mock('../../../../common/lib/kibana', () => {
const original = jest.requireActual('../../../../common/lib/kibana');

Expand Down Expand Up @@ -369,6 +369,11 @@ describe('Properties', () => {
);
wrapper.find('[data-test-subj="settings-gear"]').at(0).simulate('click');
wrapper.find('[data-test-subj="attach-timeline-case"]').first().simulate('click');

await act(async () => {
await Promise.resolve({});
});

expect(mockNavigateToApp).toBeCalledWith('securitySolution:case', { path: '/create' });
expect(mockDispatch).toBeCalledWith(
setInsertTimeline({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,18 @@ export const Properties = React.memo<Props>(
(id: string) => {
onCloseCaseModal();

dispatch(
setInsertTimeline({
graphEventId,
timelineId,
timelineSavedObjectId: currentTimeline.savedObjectId,
timelineTitle: title.length > 0 ? title : i18n.UNTITLED_TIMELINE,
})
);

navigateToApp(`${APP_ID}:${SecurityPageName.case}`, {
path: getCaseDetailsUrl({ id }),
});
}).then(() =>
dispatch(
setInsertTimeline({
graphEventId,
timelineId,
timelineSavedObjectId: currentTimeline.savedObjectId,
timelineTitle: title.length > 0 ? title : i18n.UNTITLED_TIMELINE,
})
)
);
},
[currentTimeline, dispatch, graphEventId, navigateToApp, onCloseCaseModal, timelineId, title]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { MonitorListComponent, noItemsMessage } from '../monitor_list';
import { renderWithRouter, shallowWithRouter } from '../../../../lib';
import * as redux from 'react-redux';

describe('MonitorList component', () => {
// Failing: See https://github.com/elastic/kibana/issues/70386
describe.skip('MonitorList component', () => {
let result: MonitorSummaryResult;
let localStorageMock: any;

Expand Down

0 comments on commit 912793c

Please sign in to comment.