Skip to content

Commit

Permalink
fixed test fixture in maps
Browse files Browse the repository at this point in the history
  • Loading branch information
gmmorris committed Jan 2, 2020
1 parent 4246b94 commit 1108dfb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 11 additions & 5 deletions x-pack/legacy/plugins/maps/server/test_utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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: () => '' }),
Expand Down

0 comments on commit 1108dfb

Please sign in to comment.