diff --git a/x-pack/plugins/security_solution/public/resolver/data_access_layer/mocks/with_manually_controlled_responses.ts b/x-pack/plugins/security_solution/public/resolver/data_access_layer/mocks/with_manually_controlled_responses.ts deleted file mode 100644 index 0fc43940ed71636..000000000000000 --- a/x-pack/plugins/security_solution/public/resolver/data_access_layer/mocks/with_manually_controlled_responses.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 { DataAccessLayer } from '../../types'; - -export function withManuallyControlledResponses( - dataAccessLayer: DataAccessLayer -): { respond: () => void; dataAccessLayer: DataAccessLayer } { - const resolvers: Set<() => void> = new Set(); - return { - respond() { - const oldResolvers = [...resolvers]; - // clear the old set before resolving, since resolving could cause more things to be added to the set - resolvers.clear(); - for (const resolve of oldResolvers) { - resolve(); - } - }, - dataAccessLayer: { - ...dataAccessLayer, - relatedEvents: controlledPromise(dataAccessLayer.relatedEvents), - resolverTree: controlledPromise(dataAccessLayer.resolverTree), - entities: controlledPromise(dataAccessLayer.entities), - }, - }; - function controlledPromise( - fn: (this: DataAccessLayer, ...args: Args) => Promise - ): (this: DataAccessLayer, ...args: Args) => Promise { - return async function (...args: Args) { - await new Promise((resolve) => { - resolvers.add(resolve); - }); - return fn.call(this, ...args); - }; - } -} diff --git a/x-pack/plugins/security_solution/public/resolver/view/specs/loading.tsx b/x-pack/plugins/security_solution/public/resolver/view/specs/loading.tsx deleted file mode 100644 index 74fb352df85bc2f..000000000000000 --- a/x-pack/plugins/security_solution/public/resolver/view/specs/loading.tsx +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 '../../test_utilities/extend_jest'; - -/* eslint-disable prefer-const */ - -import { Simulator } from '../../test_utilities/simulator'; -import { oneAncestorTwoChildren } from '../../data_access_layer/mocks/one_ancestor_two_children'; -import { withManuallyControlledResponses } from '../../data_access_layer/mocks/with_manually_controlled_responses'; - -/** - * These specs define the loading behavior for the graph and panel. - */ -describe('when resolver is mounted with a databaseDocumentID', () => { - let respond: () => void; - let simulator: Simulator; - let resolverComponentInstanceID = 'resolverComponentInstanceID'; - let entityIDs: { origin: string; firstChild: string; secondChild: string }; - beforeEach(() => { - const { metadata, dataAccessLayer } = oneAncestorTwoChildren(); - const dataController = withManuallyControlledResponses(dataAccessLayer); - respond = dataController.respond; - simulator = new Simulator({ - databaseDocumentID: metadata.databaseDocumentID, - dataAccessLayer: dataController.dataAccessLayer, - resolverComponentInstanceID, - }); - }); - it('should show a loading message', async () => { - await expect( - simulator.mapStateTransitions(() => { - return simulator.graphLoadingElement().length; - }) - ).toSometimesYieldEqualTo(1); - }); -});