Skip to content

Commit

Permalink
Add failed test for useCallback in shallow renderer test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
chenesan committed May 30, 2019
1 parent 3b23022 commit b2dff28
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,22 @@ describe('ReactShallowRenderer with hooks', () => {
expect(firstResult).toEqual(secondResult);
});

it('should work with useCallback', () => {
function SomeComponent() {
const noop = React.useCallback(() => {}, []);

return (
<div onClick={noop} />
);
}

const shallowRenderer = createRenderer();
let firstResult = shallowRenderer.render(<SomeComponent />);
let secondResult = shallowRenderer.render(<SomeComponent />);

expect(firstResult).toEqual(secondResult);
});

it('should work with useContext', () => {
const SomeContext = React.createContext('default');

Expand Down

0 comments on commit b2dff28

Please sign in to comment.