From 34195271c533a002b64d30633bc0e262b1904198 Mon Sep 17 00:00:00 2001 From: Brent Kimmel Date: Wed, 12 Aug 2020 11:56:05 -0400 Subject: [PATCH] [Security Solution][Resolver]Enzyme test related events closing (#74811) --- .../resolver/view/clickthrough.test.tsx | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/security_solution/public/resolver/view/clickthrough.test.tsx b/x-pack/plugins/security_solution/public/resolver/view/clickthrough.test.tsx index 296e5b253c0b91..60122f2e450c70 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/clickthrough.test.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/clickthrough.test.tsx @@ -162,10 +162,28 @@ describe('Resolver, when analyzing a tree that has two related events for the or button.simulate('click'); } }); - it('should open the submenu', async () => { + it('should open the submenu and display exactly one option with the correct count', async () => { await expect( simulator.map(() => simulator.processNodeSubmenuItems().map((node) => node.text())) ).toYieldEqualTo(['2 registry']); + await expect( + simulator.map(() => simulator.processNodeSubmenuItems().length) + ).toYieldEqualTo(1); + }); + }); + describe('and when the related events button is clicked again', () => { + beforeEach(async () => { + const button = await simulator.resolveWrapper(() => + simulator.processNodeRelatedEventButton(entityIDs.origin) + ); + if (button) { + button.simulate('click'); + } + }); + it('should close the submenu', async () => { + await expect( + simulator.map(() => simulator.processNodeSubmenuItems().length) + ).toYieldEqualTo(0); }); }); });