Skip to content

Commit

Permalink
Create plugin mock for event log plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecote committed Feb 6, 2020
1 parent 8aa2b61 commit d85819f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
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,
};

0 comments on commit d85819f

Please sign in to comment.