Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create plugin mock for event log plugin #57048

Merged
merged 3 commits into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions x-pack/plugins/event_log/server/event_log_service.mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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 { IEventLogService } from './types';

const createEventLogServiceMock = () => {
const mock: jest.Mocked<IEventLogService> = {
isEnabled: jest.fn(),
isLoggingEntries: jest.fn(),
isIndexingEntries: jest.fn(),
registerProviderActions: jest.fn(),
isProviderActionRegistered: jest.fn(),
getProviderActions: jest.fn(),
getLogger: jest.fn(),
};
return mock;
};

export const eventLogServiceMock = {
create: createEventLogServiceMock,
};
20 changes: 20 additions & 0 deletions x-pack/plugins/event_log/server/mocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* 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 { eventLogServiceMock } from './event_log_service.mock';

const createSetupMock = () => {
return eventLogServiceMock.create();
};

const createStartMock = () => {
return undefined;
};

export const eventLogMock = {
createSetup: createSetupMock,
createStart: createStartMock,
};