diff --git a/x-pack/plugins/observability/public/components/shared/header_menu_portal.test.tsx b/x-pack/plugins/observability/public/components/shared/header_menu_portal.test.tsx index 6700e52788a3a..4e9a1ae2c587f 100644 --- a/x-pack/plugins/observability/public/components/shared/header_menu_portal.test.tsx +++ b/x-pack/plugins/observability/public/components/shared/header_menu_portal.test.tsx @@ -10,13 +10,17 @@ import React from 'react'; import HeaderMenuPortal from './header_menu_portal'; describe('HeaderMenuPortal', () => { - describe('render', () => { - it('sets the header action menu', () => { + describe('when unmounted', () => { + it('calls setHeaderActionMenu with undefined', () => { const setHeaderActionMenu = jest.fn(); - render(test); + const { unmount } = render( + test + ); - expect(setHeaderActionMenu).toHaveBeenCalled(); + unmount(); + + expect(setHeaderActionMenu).toHaveBeenCalledWith(undefined); }); }); });