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 296e5b253c0b9..60122f2e450c7 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); }); }); });