Skip to content

Commit

Permalink
Test unmounting and calling with undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
smith committed May 28, 2021
1 parent fb86497 commit 60063d0
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(<HeaderMenuPortal setHeaderActionMenu={setHeaderActionMenu}>test</HeaderMenuPortal>);
const { unmount } = render(
<HeaderMenuPortal setHeaderActionMenu={setHeaderActionMenu}>test</HeaderMenuPortal>
);

expect(setHeaderActionMenu).toHaveBeenCalled();
unmount();

expect(setHeaderActionMenu).toHaveBeenCalledWith(undefined);
});
});
});

0 comments on commit 60063d0

Please sign in to comment.