From 1108dfbb5b2012bfd7f9afd7aa83ec7e22da995c Mon Sep 17 00:00:00 2001 From: Gidi Meir Morris Date: Thu, 2 Jan 2020 13:43:11 +0000 Subject: [PATCH] fixed test fixture in maps --- .../maps_telemetry/maps_usage_collector.js | 2 +- .../plugins/maps/server/test_utils/index.js | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/x-pack/legacy/plugins/maps/server/maps_telemetry/maps_usage_collector.js b/x-pack/legacy/plugins/maps/server/maps_telemetry/maps_usage_collector.js index d5317be150648..4f2ab7e977da9 100644 --- a/x-pack/legacy/plugins/maps/server/maps_telemetry/maps_usage_collector.js +++ b/x-pack/legacy/plugins/maps/server/maps_telemetry/maps_usage_collector.js @@ -20,7 +20,7 @@ async function isTaskManagerReady(server) { async function fetch(server) { let docs; - const taskManager = server.newPlatform.start.plugins.kibanaTaskManager; + const taskManager = server?.newPlatform?.start?.plugins?.kibanaTaskManager; if (!taskManager) { return null; diff --git a/x-pack/legacy/plugins/maps/server/test_utils/index.js b/x-pack/legacy/plugins/maps/server/test_utils/index.js index 944d65a21aae2..aacb9dc54e8e3 100644 --- a/x-pack/legacy/plugins/maps/server/test_utils/index.js +++ b/x-pack/legacy/plugins/maps/server/test_utils/index.js @@ -25,7 +25,7 @@ export const getMockCallWithInternal = (hits = defaultMockSavedObjects) => { export const getMockTaskFetch = (docs = defaultMockTaskDocs) => { return () => Promise.resolve({ docs }); }; - +//server?.newPlatform?.start?.plugins?.kibanaTaskManager export const getMockKbnServer = ( mockCallWithInternal = getMockCallWithInternal(), mockTaskFetch = getMockTaskFetch() @@ -37,10 +37,16 @@ export const getMockKbnServer = ( }), }, xpack_main: {}, - task_manager: { - registerTaskDefinitions: () => undefined, - schedule: () => Promise.resolve(), - fetch: mockTaskFetch, + }, + newPlatform: { + start: { + plugins: { + kibanaTaskManager: { + registerTaskDefinitions: () => undefined, + schedule: () => Promise.resolve(), + fetch: mockTaskFetch, + }, + }, }, }, config: () => ({ get: () => '' }),