From aef2a444e17f764d6371505b1d445b9223a2f619 Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Mon, 20 Sep 2021 14:22:19 -0400 Subject: [PATCH] Update tests --- .../fleet/server/saved_objects/index.ts | 6 ++--- .../server/services/preconfiguration.test.ts | 27 +++++++++---------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/x-pack/plugins/fleet/server/saved_objects/index.ts b/x-pack/plugins/fleet/server/saved_objects/index.ts index 2720f2a64b532..83188e0047044 100644 --- a/x-pack/plugins/fleet/server/saved_objects/index.ts +++ b/x-pack/plugins/fleet/server/saved_objects/index.ts @@ -198,14 +198,14 @@ const getSavedObjectTypes = ( }, mappings: { properties: { - output_id: { type: 'keyword' }, + output_id: { type: 'keyword', index: false }, name: { type: 'keyword' }, type: { type: 'keyword' }, is_default: { type: 'boolean' }, hosts: { type: 'keyword' }, ca_sha256: { type: 'keyword', index: false }, - config: { type: 'flattened', index: false }, - config_yaml: { type: 'text', index: false }, + config: { type: 'flattened' }, + config_yaml: { type: 'text' }, is_preconfigured: { type: 'boolean', index: false }, }, }, diff --git a/x-pack/plugins/fleet/server/services/preconfiguration.test.ts b/x-pack/plugins/fleet/server/services/preconfiguration.test.ts index 15fbc09f97448..99c1ff9dad60a 100644 --- a/x-pack/plugins/fleet/server/services/preconfiguration.test.ts +++ b/x-pack/plugins/fleet/server/services/preconfiguration.test.ts @@ -492,21 +492,18 @@ describe('output preconfiguration', () => { mockedOutputService.create.mockReset(); mockedOutputService.update.mockReset(); mockedOutputService.getDefaultESHosts.mockReturnValue(['http://default-es:9200']); - mockedOutputService.get.mockImplementation(async (soClient, id): Promise => { - switch (id) { - case 'existing-output-1': - return { - id: 'existing-output-1', - is_default: false, - name: 'Output 1', - // @ts-ignore - type: 'elasticsearch', - hosts: ['http://es.co:80'], - is_preconfigured: true, - }; - default: - throw soClient.errors.createGenericNotFoundError(id); - } + mockedOutputService.bulkGet.mockImplementation(async (soClient, id): Promise => { + return [ + { + id: 'existing-output-1', + is_default: false, + name: 'Output 1', + // @ts-ignore + type: 'elasticsearch', + hosts: ['http://es.co:80'], + is_preconfigured: true, + }, + ]; }); });