Skip to content

Commit b2dff28

Browse files
committed
Add failed test for useCallback in shallow renderer test suite
1 parent 3b23022 commit b2dff28

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/react-test-renderer/src/__tests__/ReactShallowRendererHooks-test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,22 @@ describe('ReactShallowRenderer with hooks', () => {
290290
expect(firstResult).toEqual(secondResult);
291291
});
292292

293+
it('should work with useCallback', () => {
294+
function SomeComponent() {
295+
const noop = React.useCallback(() => {}, []);
296+
297+
return (
298+
<div onClick={noop} />
299+
);
300+
}
301+
302+
const shallowRenderer = createRenderer();
303+
let firstResult = shallowRenderer.render(<SomeComponent />);
304+
let secondResult = shallowRenderer.render(<SomeComponent />);
305+
306+
expect(firstResult).toEqual(secondResult);
307+
});
308+
293309
it('should work with useContext', () => {
294310
const SomeContext = React.createContext('default');
295311

0 commit comments

Comments
 (0)