-
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.
Account for spaces being disabled in ClientsService
* Updates types to reflect that spaces may be unavailable * Adds a test for getSpaceId's behavior when spaces are disabled
- Loading branch information
Showing
3 changed files
with
37 additions
and
7 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
32 changes: 32 additions & 0 deletions
32
x-pack/legacy/plugins/siem/server/services/clients.test.ts
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,32 @@ | ||
/* | ||
* 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 { coreMock, httpServerMock } from '../../../../../../src/core/server/mocks'; | ||
import { actionsMock } from '../../../../../plugins/actions/server/mocks'; | ||
|
||
import { ClientsService } from './clients'; | ||
|
||
describe('ClientsService', () => { | ||
describe('spacesClient', () => { | ||
describe('#getSpaceId', () => { | ||
it('returns the default spaceId if spaces are disabled', async () => { | ||
const clients = new ClientsService(); | ||
|
||
const actions = actionsMock.createStart(); | ||
const { elasticsearch } = coreMock.createSetup(); | ||
const { savedObjects } = coreMock.createStart(); | ||
const request = httpServerMock.createRawRequest(); | ||
const spacesService = undefined; | ||
|
||
clients.setup(elasticsearch.dataClient, spacesService); | ||
clients.start(savedObjects, actions); | ||
|
||
const { spacesClient } = await clients.createGetScoped()(request); | ||
expect(spacesClient.getSpaceId()).toEqual('default'); | ||
}); | ||
}); | ||
}); | ||
}); |
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