-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Create plugin mock for event log plugin * Share event logger mock with event log service Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
- Loading branch information
1 parent
00a296b
commit ca9a8e1
Showing
5 changed files
with
64 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* 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'; | ||
import { eventLoggerMock } from './event_logger.mock'; | ||
|
||
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().mockReturnValue(eventLoggerMock.create()), | ||
}; | ||
return mock; | ||
}; | ||
|
||
export const eventLogServiceMock = { | ||
create: createEventLogServiceMock, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* 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'; | ||
|
||
export { eventLogServiceMock }; | ||
export { eventLoggerMock } from './event_logger.mock'; | ||
|
||
const createSetupMock = () => { | ||
return eventLogServiceMock.create(); | ||
}; | ||
|
||
const createStartMock = () => { | ||
return undefined; | ||
}; | ||
|
||
export const eventLogMock = { | ||
createSetup: createSetupMock, | ||
createStart: createStartMock, | ||
}; |